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

Function position()

Subject: Function position()
From: "Partho Paul" <uk4u@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 01 Feb 2001 12:33:37 +0100
function position
I have the following xml-structure:


                                            Chapter           
                                           /            \
                                        /                  \
                             Paragraph              Paragraph
                            /  |  \    \                      /   |   \
                        /      |     \     \                    etc.
                    /          |        \     \              
                /              |          \      \           
            Text   StretchText  Text   StretchText


Now I need in each StretchText-Node the number of itself.
That means what is the number of the StretchText - node if I look at 
the whole tree. So I can count  ALL Stretchtext-nodes from 1 to n.

If I use 'position()' I only get the node number of Stretchtext from the node 'Paragraph',
So each Stretchtext child is countet from 1 to m in each Paragraph,
but I need to count in the whole tree.

I used the following:

<xsl:template match"Chapter">
 <xsl:apply-template  select="Paragraph"/>
</xsl:template>

<xsl:template match"Paragraph">
 <xsl:value-of select="Text"/>
 <xsl:apply-template  select="StretchText"/>
</xsl:template>

<xsl:template match"StretchText">
 <xsl:value-of select="position()"/>        ---> THIS doesn't work in my case.
</xsl:template>
---------------------------------------------------------------------------------------------------------------
Isn't it possible to do like the following: can't I tell the function 'position()' to count
the StretchText-nodes from the root node and not from Paragraph????

Things like <xsl:value-of select="Chapter//StretchText[position()]"/> does not work.

Thank you.

Partho
_______________________________________________________________________
Partho Paul                     email: uk4u@xxxxxxxxxxxxxxxxxxx
Computer science student        or:    paul@xxxxxxxxx
-----------------------------------------------------------------------
Homepage:   http://www.partho.de
Durga Puja: http://www.uni-karlsruhe.de/~uk4u/durga.html


 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.