[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Displaying multiple instances of the same tag
Thanks to Sameer and Josh for their suggestions,
Actually, I tried every way I could think of of adding: <xsl:appy-templates select="quote"/> and <xsl:template match="quote"> <xsl:value-of select="." /> </xsl:template> to my xsl stylesheet unsuccessfully. If anyone is able to show me what the xsl file should look like with a display all quotes template above the table, I'd be very grateful (and promise to bother you no more!). here is my xsl: <?xml version="1.0" encoding="ISO-8859-1"?> <!-- Edited with XML Spy v4.2 --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <h2>Your Selection</h2> <table border="1"> <tr bgcolor="#9acd32"> <th>Title</th> <th>Artist</th> </tr> <xsl:for-each select="catalog/cd"> <tr> <td><xsl:value-of select="title"/> </td> <xsl:choose> <xsl:when test="artist = 'Book'"> <td bgcolor="#ff00ff"> <xsl:value-of select="name"/> </td> </xsl:when> <xsl:when test="artist = 'Journal Article'"> <td bgcolor="#cccccc"> <xsl:value-of select="journal"/></td> </xsl:when> <xsl:otherwise> <td><xsl:value-of select="artist"/></td> </xsl:otherwise> </xsl:choose> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> and here is my xml: <?xml version="1.0" encoding="ISO-8859-1"?> <!-- Edited with XML Spy v4.2 --> <?xml-stylesheet type="text/xsl" href="cdcatalog_choose2.xsl"?> <catalog> <cd> <title>Empire Burlesque</title> <artist>Book</artist> <name>Transaction Yeah</name> <country>USA</country> <company>Columbia</company> <price>10.90</price> <year>1985</year> <quote>I am cool</quote> <quote>You are cool</quote> <quote>We are cool</quote> </cd> <cd> <title>Hide your heart</title> <artist>Journal Article</artist> <journal>Transactions</journal> <country>UK</country> <company>CBS Records</company> <price>9.90</price> <year>1988</year> </cd> <cd> <title>Greatest Hits</title> <artist>Dan Palmer</artist> <country>USA</country> <company>RCA</company> <price>9.90</price> <year>1982</year> </cd> </catalog> Best, Dan On 12/06/2004, at 3:45 PM, Samooo wrote: You can use <xsl:appy-templates select="quote"/> and <xsl:template match="quote"> <xsl:value-of select="." /> </xsl:template>
|
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
|