|
Subject: node() grouping From: Earl Bingham <earl@xxxxxxxxx> Date: Wed, 03 Nov 1999 15:10:36 -0800 |
I want to group a series of XML fragments associated with a specific
node
value within that group. For example:
input file:
<?xml version="1.0"?>
<cars>
<car>
<carType>Volkswagon</carType>
<color>blue</color>
</car>
<car>
<carType>Volkswagon</carType>
<color>red</color>
</car>
<car>
<carType>Jeep</carType>
<color>green</color>
</car>
</cars>
Then the output would looke like:
<html>
<table>
<tr>
<td>Volksewagon</td>
<td>blue</td>
<td>red</td>
</tr>
<tr>
<td>Jeep</td>
<td>green</td>
</tr>
</table>
</html>
stylesheet: (doesn't work)
<xsl:stylesheet>
<xsl:template match="cars">
<html>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="car">
<table>
<xsl:for-each select="carType[node()]">
<tr>
<td><xsl:value-of select="text()"/></td>
<xsl:apply-templates/>
</tr>
</xsl:for-each>
</table>
</xsl:template>
<xsl:template match="color">
<tr>
<xsl:value-of select="text()"/>
</tr>
</xsl:template>
begin:vcard n:Bingham;Earl tel;cell:(408) 806-6642 tel;fax:(650) 559-1738 tel;home:(650) 559-1738 tel;work:(408) 993-2140 x-mozilla-html:FALSE url:http://www.b-bop.com org:B-Bop Associates Inc.;Engineering adr:;;2 North First Street;San Jose;CA;94024;USA version:2.1 email;internet:earl@xxxxxxxxx title:Senior Software Engineer note:"Live Free Or Die" fn:Earl Bingham end:vcard
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: preceding-sibling on sorted nod, Kay Michael | Thread | RE:, Mark Hayes |
| Re:, Keith Visco | Date | Re: Re[2]: Re:XSL FOs -> PDF using , Sebastian Rahtz |
| Month |