This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: insert an attribute value through xsl
- From: "Joerg Heinicke" <joerg dot heinicke at gmx dot de>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Wed, 30 Jan 2002 19:49:43 +0100
- Subject: Re: [xsl] insert an attribute value through xsl
- References: <F215ZndKaQf0Stamg6d00006086@hotmail.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
You can use the position()-function to get these numbers:
<xsl:template match="Family">
<tr>
<td><xsl:value-of select="position()"/></td>
<td><xsl:value-of select="name"/></td>
...
</tr>
</xsl:template>
Regards,
Joerg
----- Original Message -----
From: "林 子芯" <minikittygo@hotmail.com>
To: <xsl-list@lists.mulberrytech.com>
Sent: Wednesday, January 30, 2002 4:12 PM
Subject: [xsl] insert an attribute value through xsl
> Hi there
> I have a question about adding an extra id tag through xsl there how...
> suppose i have a xml file with such structure: -
>
> <Family>
> <name>Smith</name>
> <parents>
> <father>John</father>
> <mother>Mary</mother>
> </parents>
> <child>Jane</child>
> </Family>
>
> <Family>
> <name>Snow</name>
> <parents>
> <father>Geroge</father>
> <mother>Sue</mother>
> </parents>
> <child>Liz</child>
> <child>Paul</child>
> </Family>
>
> etc....
>
> now i wish to transform such data in a table in HTML, however, i would
like
> to
> add an extra piece of information; an id number for each no (i.e.
> --------------------------------------------------------
> familyno | Family name | Parents | Children |
> --------------------------------------------------------
> 1 |Smith |John, Mary |Jane |
> ---------------------------------------------------------
> 2 |Snow |Geogre, Sue |Liz, Paul |
> )
>
> how am i suppose to add an id on each family through xsl? do i have to go
> through
> a "double process" (e.g. adding an id attribute in the family tag, then
> convert) or is there a single step to do so?
> thanks for your time
>
> Regards
> Kit
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list