|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] node() grouping
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
|
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
|






