Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="UTF-8"?>
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <!--Normalment preservar espais en strings com nom o title, i esborrar espais en numeros com year, price
- <xsl:strip-space elements="catalog"/>
- <xsl:preserve-space elements="title artist" />
- -->
- <xsl:template match="/">
- <html>
- <body>
- <h2>My CD Collection </h2>
- <h3>Number of cds </h3> <xsl:value-of select="count(//cd)"/>
- <xsl:apply-templates select = "/catalog/cd"/>
- <table border = "1">
- <tr bgcolor="#9acd32">
- <th>Title</th>
- <th>Artist</th>
- <th>Year</th>
- </tr>
- <xsl:for-each select="/catalog/cd">
- <xsl:sort select="artist" order="descending" data-type="text"/>
- <tr>
- <td> <xsl:apply-templates select = "artist"/></td>
- <td><xsl:apply-templates select = "title"/></td>
- <td><xsl:value-of select="year"/></td>
- </tr>
- </xsl:for-each>
- </table>
- </body>
- </html>
- </xsl:template>
- <xsl:template match="cd">
- <p>
- <xsl:apply-templates select="artist"/>
- <xsl:apply-templates select = "artist" mode="plantilla1"/>
- <xsl:apply-templates select="year"/>
- </p>
- </xsl:template>
- <xsl:template match="artist" mode="plantilla1">
- <p>
- Total Artista : <xsl:value-of select="count(.)"/>
- </p>
- </xsl:template>
- <xsl:template match="title">
- Title: <span style="color:#ff0000">
- <xsl:value-of select="."/></span>
- <br />
- </xsl:template>
- <xsl:template match="artist">
- <company>Nicrosoft</company>
- Artist: <span style="color:#00ff00">
- <xsl:value-of select="."/></span>
- <br />
- </xsl:template>
- <xsl:template match="year">
- <p>
- Year: <span style="color:#ff0000">
- <xsl:value-of select="."/></span>
- </p>
- </xsl:template>
- </xsl:stylesheet>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement