Here's my xml:
Expand|Select|Wrap|Line Numbers
- <Result>
- <DressPrice>
- <Name>Dress 2</Name>
- <Price>20</Price>
- <Image>2.jpeg</Image>
- </DressPrice>
- <DressPrice>
- <Name>Dress 9</Name>
- <Price>20</Price>
- <Image>3.jpeg</Image>
- </DressPrice>
- <DressPrice>
- <Name>Dress 10</Name>
- <Price>20</Price>
- <Image>0905C58A0179_1.jpeg</Image>
- </DressPrice>
- <DressPrice>
- <Name>Dress 11</Name>
- <Price>20</Price>
- <Image>0905C58A0179_1.jpeg</Image>
- </DressPrice>
- <DressPrice>
- <Name>Dress 12</Name>
- <Price>20</Price>
- <Image>0905C58A0179_1.jpeg</Image>
- </DressPrice>
- </Result>
Expand|Select|Wrap|Line Numbers
- <?xml version="1.0" encoding="UTF-8"?>
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
- <xsl:strip-space elements="*" />
- <xsl:template match="/">
- <html>
- <head><title>Dresses Per Price</title>
- <link rel="stylesheet" type="text/css" href="price.css"/>
- </head>
- <body>
- <h3>Dresses Per Price Displayed</h3>
- <table border="1">
- <thead>
- <tr style="background-color:PaleGreen;"><th>Name</th><th>Price</th><th>Image</th></tr>
- </thead>
- <tbody>
- <xsl:for-each select="Result">
- <xsl:apply-templates>
- <xsl:sort select="Name" data-type="text" order="ascending"/>
- </xsl:apply-templates>
- </xsl:for-each>
- </tbody>
- </table>
- <p><strong>Note:</strong>Data listed above may not reflect the current state</p>
- </body>
- </html>
- </xsl:template>
- <xsl:template match="DressPrice">
- <xsl:variable name="cssClass">
- <xsl:choose>
- <xsl:when test="position() mod 2 = 0">coloured</xsl:when>
- <xsl:otherwise>normal</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <tr class="{$cssClass}">
- <xsl:apply-templates select="Name"/>
- <xsl:apply-templates select="Price"/>
- <xsl:apply-templates select="Image"/>
- </tr>
- </xsl:template>
- <xsl:template match="Name|Price|Image">
- <td><xsl:value-of select="text()"/></td>
- </xsl:template>
- </xsl:stylesheet>
Can someone please help me or point me in the right direction? Thanks