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: Any suggestion.


Hi,

>>  <xsl:variable name="totalChapters">  <xsl:value-of
>> select="//chapter[last()]"/>  </xsl:variable>  
>>  <xsl:template match="/">  <xsl:value-of select="$totalChapters"/>
>> </xsl:template>  

I'm probably jumping to conclusions, but from the names of the variables it
looks as if you were after the number of chapters in the source?  If that's
the case, then you probably want:

  <xsl:variable name="totalChapters" select="count(//chapter)" />

If you *did* want to get hold of the last chapter, you're usually better
off using a 'select' attribute to get the node that you're interested in
rather than storing its value as a result tree fragment (which is what
happens when you set the value of a variable through its content):

  <xsl:variable name="totalChapters" select="//chapter[last()]" />

I've no idea why it's not working, but it's probably to do with using an
old version of MSXML - see http://www.netcrucible.com/xslt/msxml-faq.html.

Sorry I can't be more help,

Jeni

Jeni Tennison
http://www.jenitennison.com/


 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]