[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: [xsl] Displaying multiple instances of the same tag
Subject: RE: [xsl] Displaying multiple instances of the same tag From: "Josh Canfield" <Josh.Canfield@xxxxxxxxxxxx> Date: Sun, 13 Jun 2004 13:17:43 -0700 |
Hmm... no bother. Answering questions and learning answers is what I ( and presumably we ) are here for. I think your problem is with context. If you want to put all of the quotes above the table, then your context will be "/" which means that the path to all of the quotes is not "quote" but instead "catalog/cd/quote". If you want to put the specific quotes for a cd inside of a cell of the table then you will be in the for-each which changes the context to "catalog/cd", and your relative path will be "quote". Here is your code revised: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" encoding="UTF-8" indent="yes"/> <xsl:template match="/"> <html> <body> <ol> <xsl:for-each select="catalog/cd/quote"> <li><xsl:value-of select="."/></li> </xsl:for-each> </ol> <h2>Your Selection</h2> <table border="1"> <tr bgcolor="#9acd32"> <th>Title</th> <th>Artist</th> <th>Quotes</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> <td> <xsl:choose> <xsl:when test="quote"> <ol> <xsl:for-each select="quote"> <li><xsl:value-of select="."/></li> </xsl:for-each> </ol> </xsl:when> <xsl:otherwise>   </xsl:otherwise> </xsl:choose> </td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Displaying multiple insta, Josh Canfield | Thread | real big sourcefile (300MB), Konrad Mader |
Re: [xsl] Displaying multiple insta, Daniel Palmer | Date | RE: [xsl] Displaying multiple insta, M. David Peterson |
Month |