XSL transformation of complicated XML

~mR.bLaCk~

New Member
I have a complicated XML and I am trying to write a XSL transformation to convert it to HTML. Could someone please help me with it?Here is the XML \[code\]<?xml version="1.0" encoding="iso-8859-1"?><?xml-stylesheet type="text/xsl" href="http://stackoverflow.com/questions/10608158/Mbooks.xsl"?><project> <books> <bookName>Eclpise</bookName> <bookCount>3</bookCount> <Data> <NEW> <bookNumber>book3687110</bookNumber> <ISBN>927fd6ca660e5a9</ISBN> <Isbninfo> <IsbninfoDetails> <IsbninfoName>new book</IsbninfoName> <IsbninfoVersion>version 1</IsbninfoVersion> </IsbninfoDetails> <IsbninfoDetails> <IsbninfoName> new book 1</IsbninfoName> <IsbninfoVersion>version 2</IsbninfoVersion> </IsbninfoDetails> </Isbninfo> </NEW> <NEW> <bookNumber>book3674796</bookNumber> <ISBN>6fa276825144</ISBN> <Isbninfo> <IsbninfoDetails> <IsbninfoName>new book 3</IsbninfoName> <IsbninfoVersion>version 3</IsbninfoVersion> </IsbninfoDetails> <IsbninfoDetails> <IsbninfoName>new book 4</IsbninfoName> <IsbninfoVersion>version 4</IsbninfoVersion> </IsbninfoDetails> </Isbninfo> </NEW> </Data> </books> <books> <bookName>ORACLE</bookName> <bookCount>0</bookCount> <Data> </Data> </books> <books> <bookName>MUSIC</bookName> <bookCount>0</bookCount> <Data> </Data> </books></project>\[/code\]Here is the XSLT.\[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> <body> <h2>BOOK_INFORMATION </h2> <table style="display: inline-block; border: 1px solid; float: left; "> <tr bgcolor="#FFA500"> <th>book Name</th> <th>book_Count</th> <th>book_Number</th> <th>ISBN</th> <th>Isbninfo_Name</th> <th>Isbninfo_Version</th> </tr> <xsl:for-each select="project/books"> <tr> <td> <xsl:value-of select="bookName"/> </td> <td> <xsl:value-of select="bookCount"/> </td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template></xsl:stylesheet>\[/code\]I am not sure how would I get the other information: I want it all in one table. I tried doing \[code\]<xsl:for-each>\[/code\] inside the for each but it does not work.
 
Back
Top