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

Absolute ordering -- determining order when position() won't

Subject: Absolute ordering -- determining order when position() won't work
From: Ross Bleakney <RossB@xxxxxxxxxxxxxxx>
Date: Mon, 4 Dec 2000 14:28:07 -0800
absolute ordering
Hello,

I have XML which consists of elements which are either folders or files:
 
<Folder name="foldera">
   <File name="a" />
   <Folder name="folderb">
   </ Folder>
   <File name="b" />
   <Folder name="folderc">
      <File name="c" />
      <File name="d" />
   </ Folder>
</Folder>
 
The order of the folders and files is arbitrary. I have written some XML to
list the names of all of the files:
 
<xsl:template name="files_folders">		
   <xsl:choose>
      <xsl:when test="self::File">				
         <xsl:call-template name="files" />
      </xsl:when>
      <xsl:when test="self::Folder">			
          <xsl:for-each select="./*">					
             <xsl:call-template name="files_folders" />

          </xsl:for-each>		
      </xsl:when>
   </xsl:choose>		
</xsl:template>
 
<xsl:template name="files">		
   <h3>
      <xsl:value-of select="@name" />
   </h3>
</xsl:template>
 
What I would like to do, is precede each file name with a number, like so:
 1 a
 2 b
 3 c
 4 d
 
If I use position(), then I will get the order of the element in the
subtree:
 1 a
 3 b
 1 c
 2 d	
 
Does anyone have any idea how to solve this problem?
Thanks,
Ross


 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.