This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Number of node in list from stylesheet


Jeni Tennison writes:
 > number, so January = 01, May = 05 and so on.  So I defined the months in
 > order within the stylesheet itself:
 > 
 > <foo:months>
 >   <foo:month name="January" abbr="Jan" />
 >   <foo:month name="February" abbr="Feb" />

wouldn't it be easier to just say

<foo:month name="February" abbr="Feb" number="02"/>

and have done with it?
 >   <xsl:variable name="monthNumber">
 >     <xsl:for-each select="document('')//foo:month[@name = $monthName]">
 >       <xsl:value-of select="format-number(position(), '00')" />
 >     </xsl:for-each>
 >   </xsl:variable>
 > 
 > always sets $monthNumber = 1.

naturally. you select a single node, so it is always #1 in resulting
list

Sebastian


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]