[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: FW: Creating Table problem
<xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" /> <xsl:template match="/Report"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title><xsl:value-of select="DataRangeX/@description"/></title> </head> <body> <table border="1"> <xsl:apply-templates select="DataRangeX"/> <xsl:apply-templates select="DataRangeY"/> </table> </body> </html> </xsl:template> <xsl:template match="DataRangeX"> <tr> <th><xsl:value-of select="@description"/></th> <xsl:apply-templates select="RangeValue"/> </tr> </xsl:template> <xsl:template match="DataRangeX/RangeValue"> <th title="{../@type}"><xsl:value-of select="."/></th> </xsl:template> <xsl:template match="DataRangeY"> <xsl:apply-templates select="RangeValue"/> </xsl:template> <xsl:template match="DataRangeY/RangeValue"> <xsl:variable name="index" select="position()"/> <tr> <td title="{../@name}"><xsl:value-of select="."/></td> <xsl:for-each select="/Report/NumericData/Column"> <xsl:apply-templates select="HDElement[$index]"/> </xsl:for-each> </tr> </xsl:template> <xsl:template match="HDElement"> <td><xsl:value-of select="."/></td> </xsl:template> </xsl:stylesheet> Cheers, Anton Triest ----- Original Message ----- From: "Bhadresha, Avinash (London)" <Avinash_Bhadresha@xxxxxx> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> Sent: Monday, August 23, 2004 1:22 PM Subject: FW: Creating Table problem Hi, I need to create a table from the following XML. <Report> <DataRangeX description="Inflation Curve" type="Percentage"> <RangeValue type="String">3.00% </RangeValue> <RangeValue type="String">0.00% </RangeValue> <RangeValue type="String">-3.00% </RangeValue> </DataRangeX> <DataRangeY name="Interest Rates"> <RangeValue>3.00%</RangeValue> <RangeValue>0.00%</RangeValue> <RangeValue>-3.00%</RangeValue> </DataRangeY> <NumericData> <Column> <HDElement>1</HDElement> <HDElement>2</HDElement> <HDElement>3</HDElement> </Column> <Column> <HDElement>4</HDElement> <HDElement>5</HDElement> <HDElement>6</HDElement> </Column> <Column> <HDElement>7</HDElement> <HDElement>8</HDElement> <HDElement>9</HDElement> </Column> </NumericData> </Report> The tAble should then have the X Range values as the header and the Y Range values labelling the rows. If possible the header should have the 'Inflation Curver' title on top of it. I'd really appreciate some help, I'm completely going in circles as to trying to come up with a solution.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|