xsl-list
[Top] [All Lists]

RE: Using <xsl:number>

2004-06-08 23:53:02
thanks heaps for that - that's solved the problem. 8-)

David.
--- Jarno(_dot_)Elovirta(_at_)nokia(_dot_)com wrote:
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))


--+------------------------------------------------------------------
XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--




        
                
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 


<Prev in Thread] Current Thread [Next in Thread>