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

Re: Numbering in a hierarchy

Subject: Re: Numbering in a hierarchy
From: "Lech Rzedzicki" <xchaotic@xxxxxxxxx>
Date: Thu, 3 Apr 2008 16:58:32 +0100
Re:  Numbering in a hierarchy
Brilliant, works perfectly, thank you so much David.

As usual, I got an excellent, quick response. This is very much
appreciated and helps so much in learning.

Lech

On Thu, Apr 3, 2008 at 4:47 PM, David Carlisle <davidc@xxxxxxxxx> wrote:
>
>  > or is it better to use saxon:assign for that?
>
>  It's never better to use saxon:assign, assigning to variable references
>  in this way completely breaks the processing model of xslt.
>
>
>  > My initial approach was to simply use <xsl:number/>
>  what was wrong with that approach?
>  It would seem that you just want
>
>
>  xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>  version="1.0">
>
>  <xsl:template match="*">
>   <xsl:copy>
>     <xsl:copy-of select="@*"/>
>     <xsl:apply-templates/>
>   </xsl:copy>
>  </xsl:template>
>
>  <xsl:template  match="group">
>    <xsl:copy>
>     <xsl:copy-of select="@*"/>
>     <xsl:attribute name="number"><xsl:number/></xsl:attribute>
>     <xsl:apply-templates/>
>   </xsl:copy>
>  </xsl:template>
>
>  <xsl:template  match="item">
>    <xsl:copy>
>     <xsl:copy-of select="@*"/>
>     <xsl:attribute name="number"><xsl:number count="group|item" level="multiple" format="1-1" /></xsl:attribute>
>     <xsl:apply-templates/>
>   </xsl:copy>
>  </xsl:template>
>
>
>  </xsl:stylesheet>
>
>
>
>  $ saxon num.xml num.xsl
>  <?xml version="1.0" encoding="utf-8"?><top>
>
>     <group number="1">
>         <item number="1-1">test</item>
>         <item number="1-2">test</item>
>         <item number="1-3">test</item>
>         <item number="1-4">test</item>
>     </group>
>     <group number="2">
>         <item number="2-1">test</item>
>   <otheritem>test</otheritem>
>         <item number="2-2">test</item>
>         <item number="2-3">test</item>
>         <item number="2-4">test</item>
>     </group>
>  </top>
>
>
>
>
>  ________________________________________________________________________
>  The Numerical Algorithms Group Ltd is a company registered in England
>  and Wales with company number 1249803. The registered office is:
>  Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
>
>  This e-mail has been scanned for all viruses by Star. The service is
>  powered by MessageLabs.
>  ________________________________________________________________________

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.