Jump to content

tnapolitano

Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by tnapolitano

  1. If you look closely at your XPath expressions, you'll see the error. Doc is the root element of the document, so It's pretty obvious why this cycle repeats only once. I don't see much point of the list element though.If you are the creator of this XML (it's not generated by some application) I would suggest that you group your things to make them more easily accesable to the XSLT. Example:
    <list><host><name>hostname1</name><ip>192.168.1.100</ip><os>windows xp</os></host><host><name>hostname2</name><ip>192.168.1.101</ip><os>mac os x</os></host></list>

    With an XML like that, it's quite easier to set the XSLT to see what information belongs to which host so it could display each on a new row.Anyway, if this XML is generated by some application, I suppose I'll try to think of something else, but it would be quite messy, I know it.

  2. XSLT noob here, and I would appreciate any help, hints or suggestions.I have a XML structured like this:<doc> <list> <host>hostname1</host> <ip>192.168.1.100</ip> <os>windows xp</os> <host>hostname2</host> <ip>192.168.1.101</ip> <os>mac os x</os> </list></doc>I have a XSL structured like this:<xsl:template match="/" > <html> <body> <h2>System Summary</h2> <table border="1"> <tr> <th align="left">Host</th> <th align="left">IP Address</th> <th align="left">Operating System</th> </tr> <xsl:for-each select="/Doc" > <tr> <td><xsl:value-of select="list/hostname" /></td> <td><xsl:value-of select="list/ip" /></td> <td><xsl:value-of select="list/os" /></td> </tr> </xsl:for-each> </table> </body> </html></xsl:template>My output stops at the first value per element (i.e., "hostname1, 192.168.1.100, Windows XP"). What do I do to make the XSLT continue through all elements of the XML? Thanks in advance.

×
×
  • Create New...