[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: position() of a current node

Subject: Re: position() of a current node
From: Daniel Bauke <bonkey@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 15 Jun 2001 16:18:53 +0200
daniel bauke
On Friday (Jun 15), Michael Kay wrote:

> I'm confused too, because your sections aren't part of a chapter, they are
> part of a part.
> 
> Getting position() values of 2,4,6 or 1,3,5 is usually because you are
> processing the whitespace nodes between elements as well as the elements.
> This doesn't seem to be the case in your example.
> 
> Please post a complete stylesheet and tell us which processor you're using.
well, it quite complicated, i'll try to reproduce it as simple as
possible, but i suspect it's sth exacly with whitespaces.

<!-- XSLT (using Cocoon 1.8) -->

<xsl:template match="/">
 <xsl:apply-templates/>
</xslt:template>

<xsl:template match="document">
<html><body>
 <xsl:apply-templates select="//chapter[@id = $chapter]"/>
</body></html>
</xslt:template>

<xsl:template match="chapter"> <!-- i've forgot to put it in
earlier example-->
<!-- ... -->
 <xsl:for-each select="section">
 <li>
    <a> <xsl:attribute name="href">sect<xsl:value-of select="position()"/></xsl:attribute> </a> 
 <xsl:value-of select="@title"/>
 </a></li>
 </xsl:for-each>
<!-- ... -->
 <xsl:apply-templates/>
</xsl:template>

<xsl:template match="chapter">
 <a> <xsl:attribute name="name">sect<xsl:value-of select="position()"/></xsl:attribute> </a> 
 <h3><xsl:value-of select="@title"/></h3>
 <xsl:apply-templates/>
</xsl:template>

<!-- XML: -->
      
<document style="xxx">
<part title="xxx" url="xxx" toc="xxx">
   <chapter shortname="xxx" id="xxx">
      <TOC title="xxx"/>
      <center>
         <para> <link href="xxx"></link> </para>
         <para> <link href="xxx"></link> </para>
      </center>
   </chapter>
</part>

<part title="xxx" url="xxx">
   <chapter title="xxx" shortname="xxx" id="xxx">
      <includescript type="xxx" file="xxx"/>
      <includescript type="xxx" file="xxx"/>
      <includescript type="xxx" file="xxx"/>
      <includescript type="xxx" file="xxx"/>
      <section title="xxx">
         <para>
         </para>
      </section>
      <section title="xxx">
         <para>
         </para>
         <para>
         </para>
      </section>
   </chapter>
</part>
</document>

(i hope i didn't cut too much :-)

-- 
Daniel `bonkey' Bauke; http://www.oho.pl/~bonkey/; {happiness=bike&&unix;}

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.