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

RE: Using <xsl:number>

Subject: RE: Using <xsl:number>
From: <Jarno.Elovirta@xxxxxxxxx>
Date: Wed, 9 Jun 2004 09:35:03 +0300
xsl number order
Hi,

> What I want to do is add a sort-order property to each
> Scope tag, which identifies its relative position at
> each level of the heirarchy among its peers only. 
> That is to say, the sort-order tag should be added
> like this:
> 
> <Data>
> 	<Scope id="1" sort-order="1">
> 		<Scope id="2" sort-order="1"/>
> 		<Scope id="3" sort-order="2"/>
> 	</Scope>
> 	<Scope id="4" sort-order="2">
> 		<Scope id="5" sort-order="1">
> 			<Scope id="6" sort-order="1"/>
> 			<Scope id="7" sort-order="2"/>
> 		</Scope>
> 		<Scope id="8" sort-order="2">
> 			<Scope id="9" sort-order="1">
> 				<Scope id="10" sort-order="1"/>
> 				<Scope id="11" sort-order="2"/>
> 			</Scope>
> 			<Scope id="12" sort-order="2"/>
> 		</Scope>
> 	</Scope>
> 	<Scope id="13" sort-order="3"/>
> </Data>

  <xsl:template match="Scope">
    <xsl:copy>
      <xsl:attribute name="sort-order">
        <xsl:number />
      </xsl:attribute>
      <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
  </xsl:template>
  <xsl:template match="@* | node()">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
  </xsl:template>

If you want to specify the attributes in xsl:number, they're

  <xsl:number level="single" count="Scope" from="Scope"/>

Cheers,

Jarno - Velvet Acid Christ: The Dead (Alive mix by Funker Vogt))

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.