[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Displaying multiple instances of the same tag

Subject: Re: Displaying multiple instances of the same tag
From: Daniel Palmer <Daniel.Palmer@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 13 Jun 2004 13:54:40 -0400
daniel palmer
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>


Sameer.


----- Original Message -----
From: "Daniel Palmer" <Daniel.Palmer@xxxxxxxxxxxxxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Saturday, June 12, 2004 9:44 AM
Subject:  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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.