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

Re: problem with numbering

Subject: Re: problem with numbering
From: michael.h.kay@xxxxxxxxxxxx
Date: Tue, 17 Sep 2002 7:55:19 +0000
xsl number level multi
You can't do this using level="multi" because element 2.1 is not a descendant of element 2. So you're going to have to build up the number yourself; which means you might as well use count() rather than <xsl:number/> - count() is a lot more flexible.

In XSLT 2.0 you can use <xsl:number> to format any sequence of numbers, so I think you can write:

<xsl:number
  select="(for $n in (ancestor::NUMMERIERUNG)[position()!=1]
           return count($n/preceding-sibling::NELEMENT)+1,
           count(preceding-sibling::NELEMENT)+1)"
  format="1.1"/>

Michael Kay
> 
> From: "Lars Geldner" <geldner@xxxxxx>
> Date: Mon, 16 Sep 2002 16:15:24 +0200
> To: <xsl-list-digest@xxxxxxxxxxxxxxxxxxxxxx>
> Subject:  problem with numbering
> 
> Hello,
> 
> I have a problem with the xsl:number-element. In the following part of a
> XML-document I am not able to produce the numbering which I have declared in
> the comments.
> 
> <NUMMERIERUNG>
>    <!--1.--><NELEMENT>text1</NELEMENT>
>    <!--2.--><NELEMENT>text2</NELEMENT>
>    <NUMMERIERUNG>
>     <!--2.1--><NELEMENT>text21</NELEMENT>
>     <!--2.2--><NELEMENT>text22</NELEMENT>
>    </NUMMERIERUNG>
>    <!--3.--><NELEMENT>text3</NELEMENT>
> </NUMMERIERUNG>
> 
> The output should be:
> 
> 1.text1
> 2.text2
> 2.1.text21
> 2.2.text22
> 3.text3
> 
> Thanks in advance,
> 
> Lars Geldner
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 


 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.