| Subject: Re: [xsl] Displaying multiple instances of the same tag From: Daniel Palmer <Daniel.Palmer@xxxxxxxxxxxxxxxxxxxxxxx> Date: Sun, 13 Jun 2004 13:54:40 -0400 | 
<xsl:appy-templates select="quote"/> and <xsl:template match="quote"> <xsl:value-of select="." /> </xsl:template>
<?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><?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
You can use <xsl:appy-templates select="quote"/> and <xsl:template match="quote"> <xsl:value-of select="." /> </xsl:template>
Sameer.
----- Original Message ----- From: "Daniel Palmer" <Daniel.Palmer@xxxxxxxxxxxxxxxxxxxxxxx> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> Sent: Saturday, June 12, 2004 9:44 AM Subject: [xsl] Displaying multiple instances of the same tag
The xml I've been playing with looks like this:
<reference> <title>Empire</title> <artist>Book</artist> <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> </reference>
In xsl, <xsl:value-of select="quote"/> of course displays only the first quote. Can someone tell me how to specify in xsl which and how many of the quotes to display in xml? I searched the archives and the other recommended FAQ page unsuccessfully.
Best, Dan Palmer
--+------------------------------------------------------------------ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/ or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx> --+--
--+------------------------------------------------------------------ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/ or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx> --+--
| Current Thread | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| Re: [xsl] Displaying multiple insta, Samooo | Thread | RE: [xsl] Displaying multiple insta, M. David Peterson | 
| Re: [xsl] Stumped on why a field is, Deirdre Saoirse Moen | Date | RE: [xsl] Displaying multiple insta, Josh Canfield | 
| Month |