OZONE Asylum
Forums
XML - XSL - XSLT - XHTML - CSS - DOM
XSLT Troubles
This page's ID:
26081
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
Hey all, I have an XML document that I am trying to convert to XML. My XML document is as follows: [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] I am using the following XSL file to translate my code: [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] Unfortunately, I am having some issues with my for-each loops. Most of the loops seem to iterate one time and then they die. I don't understand why this is happening so I thought I would ask you all! The following is the output of my translation: [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> [/code] If anyone has any suggestions, I would love to hear them. Thank you for your time. [small](Edited by [internallink=26080]atomaka[/internallink] on 06-21-2005 22:33)[/small]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »