|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: problem with proper numbering
"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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








