Topic: XSLT Troubles (Page 1 of 1) |
|
---|---|
Neurotic (0) Inmate Newly admitted From: |
posted 06-21-2005 21:12
Hey all, code: <?xml version="1.0" encoding="ISO-8859-1"?> <report> <salescodes> <code>AAA</code> <code>BBB</code> </salescodes> <title>This is the Title</title> <headers> <header>Mo 1 (Accum)</header> <header>Mo 2</header> <header>Mo 3</header> <header>Mo 4</header> <header>Mo 5</header> <header>Mo 6</header> <header>Mo 7</header> <header>Mo 8</header> <header>Mo 9</header> </headers> <models> <model> <plantid>#####</plantid> <modelyear>Model Year 1</modelyear> <total>81194</total> <accum>45484</accum> <months> <month>6863</month> <month>7744</month> <month>8959</month> <month>10137</month> <month>2007</month> <month>0</month> <month></month> <month></month> <month></month> <month></month> <month></month> <month></month> <month></month> <month></month> </months> </model> <model> <plantid>######</plantid> <modelyear>Model Year 2</modelyear> <total>82696</total> <accum>74858</accum> <months> <month>7838</month> <month>0</month> <month>0</month> <month>0</month> <month>0</month> <month>0</month> <month></month> <month></month> <month></month> <month></month> <month></month> <month></month> <month></month> <month></month> </months> </model> </models> </report>
code: <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <head> <title><xsl:value-of select="report/title" /></title> </head> <body> <h2><xsl:value-of select="report/title" /></h2> <h3> <xsl:for-each select="report/salescodes"> <xsl:value-of select="code" />, </xsl:for-each> </h3> <table border="1"> <tr bgcolor="#9acd32"> <th align="left">Requirements</th> <xsl:for-each select="report/headers"> <th align="left"><xsl:value-of select="header" /></th> </xsl:for-each> <th align="left">Total</th> </tr> <xsl:for-each select="report/models"> <tr> <td><xsl:value-of select="modelyear" /></td> <td><xsl:value-of select="accum" /></td> <xsl:for-each select="months"> <td><xsl:value-of select="month" /></td> </xsl:for-each> <td><xsl:value-of select="total" /></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet>
code: <html> <head> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>title</title> </head> <body> <h2>titel</h2> <h3>AAA </h3> <table border="1"> <tr bgcolor="#9acd32"> <th align="left">Requirements</th><th align="left">Mo 1 (Accum)</th><th align="left">Total</th> </tr> <tr> <td></td><td></td><td></td> </tr> </table> </body> </html>
|
Maniac (V) Mad Scientist From: Rochester, New York, USA |
posted 06-21-2005 21:59
You only have one salescodes element, but you have multiple code elements, try |
Obsessive-Compulsive (I) Inmate From: |
posted 06-21-2005 22:32
Hey Dan, code: <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <head> <title><xsl:value-of select="report/title" /></title> </head> <body> <h2><xsl:value-of select="report/title" /></h2> <h3> <xsl:for-each select="report/salescodes/code"> <xsl:value-of select="." />, </xsl:for-each> </h3> <table border="1"> <tr bgcolor="#9acd32"> <th align="left">Requirements</th> <xsl:for-each select="report/headers/header"> <th align="left"><xsl:value-of select="." /></th> </xsl:for-each> <th align="left">Total</th> </tr> <xsl:for-each select="report/models/model"> <tr> <td><xsl:value-of select="modelyear" /></td> <td><xsl:value-of select="accum" /></td> <xsl:for-each select="months/month"> <td><xsl:value-of select="." /></td> </xsl:for-each> <td><xsl:value-of select="total" /></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> |