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

Re: problem with proper numbering

Subject: Re: problem with proper numbering
From: Joerg Pietschmann <joerg.pietschmann@xxxxxx>
Date: Tue, 02 Oct 2001 18:51:14 +0200
proper numbering of newsletter
"Andreas Putscher" <andreasputscher@xxxxxx> wrote
> Hi everybody,
[...]
> So I would like to transform "slidesets" and "slides" into "cards". The
> problem I have is concerned with the numbering of the "cards".
[...]
> So the position() function does not work in here as it starts numbering the
> card-id with "a" again and again
That's how position() works, by design. Look it up in the spec.

>, but what I want is strictly ascending numbering of the id.

The default answers are:
a) Use <xsl:number count="slideset|slide" level="any" format="a"/>
b) Use "count(preceding::slideset|preceding::slide)" instead of "position()"
c) Use <card id="{generate-id()}"> ... instead of
   <card>
     <xsl:attribute name="id"><xsl:number ...></xsl:attribute>
     ...
The last possibility uses a shortcut called attribute value template
instead of the more verbose <xsl:attribute> you used.
As a rule of thumb, c) should be faster than a) which in turn should
be noticable faster than b), however, generate-id() generates usually
strings of several characters, which might matter in the case of
generating WML.

See http://www.w3c.org/TR/xslt#number, http://www.w3.org/TR/xpath#axes,
http://www.w3.org/TR/xpath#section-Node-Set-Functions and
http://www.w3c.org/TR/xslt#misc-func

Untested, try it out by yourself. HTH anyway
J.Pietschmann

 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.