xsl-list
[Top] [All Lists]

RE: putting number values

2003-03-04 03:49:16
|in the bellow code you can see that with the <xsl:value-of 
|select="name"/> i writte the value of name tag with this i get 
|100 values.
|<xsl:for-each select="registro">
|<xsl:value-of select="name"/>
|</xsl:for-each>
|but with xslt how can i number them?
|how can i put in this method:
|1 value of name 1
|2 value of name 2
|....
|how can i put the number, the result number?
|thanks

If they're all separate elements (and your for-each select implies that
this is the case) you can probably just use the position() function:

<xsl:for-each select="registro">
   <xsl:value-of select="concat(position(), ' ', name)"/>
</xsl:for-each>

Here, I've used concat to format the output text a little.

The other option might be to use <xsl:number />, which would number all
the sibling elements consecutively.  Have a look at Michael Kay's XSLT
programmer's reference for more information about these.



Regards
Allan Jones

Tel:    0121 506 9111
Fax:    0121 506 9112
------------------------------------------------------------------------
----------------
HYFINITY LIMITED. Registered in England & Wales 4136884. Registered
Office:
Blythe Valley Innovation Centre, Central Boulevard, Blythe Valley Park,
Solihull, West Midlands, B90 8AJ. Tel: +44 (0)121 506 9111.

The information contained within this email, together with any
attachments,
is intended solely for the named recipient(s) and may contain privileged
and/or confidential information. If you receive this in error, please
notify
hyfinity limited immediately and delete this e-mail.

Any views or opinions represented in this e-mail are solely those of the
author and do not necessarily represent those of hyfinity or its
affiliate
companies.

Although this e-mail and its attachments have been scanned for the
presence
of computer viruses, hyfinity will not be liable for any losses as a
result
of any viruses being passed on. 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



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