OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: RE: problem with position()

Stefan Seefeld [mailto:stefan@seefeld.name] wrote:

> <xsl:template match="d:section/d:orderedlist/d:listitem" mode="xref-to">
>    <xsl:param name="referrer"/>
>    <xsl:param name="xrefstyle"/>
>    [<xsl:value-of
> select="ancestor::d:section/d:titleabbrev"/>]/<xsl:copy-of
> select="position()"/>
> </xsl:template>
> However, this always results in a label of the form "[...]/1", i.e. the
> reported position is "1", no matter whether the matched listitem is
> actually the first or not. (Please find attached a little test doc that
> results in:

The value returned by the "position" function depends on the context in which you retrieve the element. It can sometimes be a mind-bending exercise to try to figure out exactly what you're supposed to get back from it.

In this case, you might try to simply count how many elements come before it, and add 1. This also lets you be more specific about what you're counting. So instead of:



	select="count(preceding-sibling::listitem) + 1"

I didn't test this, but I think it should work.

Rob Cavicchio
Principal Technical Writer & Information Architect
EMC Captiva
Information Intelligence Group
EMC Corporation
3721 Valley Centre Drive, Ste 200
San Diego, CA 92130

P: (858) 320-1208
F: (858) 320-1010
E: rob.cavicchio@emc.com

The opinions expressed here are my personal opinions. Content published here is not read or approved in advance by EMC and does not necessarily reflect the views and opinions of EMC.

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]