Whats wrong with this XSLT?

Dark-Lord

New Member
Below is my XML code - \[code\]<Para> <Desc>....</Desc> <References> <BookRef> <BookName>ABC of HTML</BookName> <Chapter>1</Chapter> <BookName>HTML : The Complete Reference</BookName> <Chapter>1</Chapter> </BookRef> </References></Para><Para> <Desc>....</Desc> <References> <BookRef> <BookName>ABC of XML</BookName> <Chapter>2</Chapter> <BookName>XML : The Complete Reference</BookName> <Chapter>10</Chapter><Chapter>11</Chapter> </BookRef> </References></Para>\[/code\]I need to display the above in tabular format using \[code\]HTML Table Tag\[/code\]. So that it should look like - \[code\]Description of Paragraph (the text between the Desc tags)**Book Name** **Chapters**ABC of HTML 1HTML: The Complete Reference 1Description of Paragraph (the text between the Desc tags)**Book Name** **Chapters**ABC of XML 2HTML: The Complete Reference 10, 11\[/code\]The reader can directly jump on the said chapters, I have created hyperlinks.Below is the XSLT code -\[code\]<xsl:template match="References"> <xsl:if test="CaseRef != ''"><br/> <table border="1" width="100%"> <tr> <td width="75%">Book Name</td> <td align="right">Chapters</td> </tr> <xsl:for-each select="BookName"> <tr> <td valign="top"> <xsl:value-of select="."/> </td> <td align="right" valign="bottom"> <xsl:for-each select="following::Chapter"> <a id="lnk"> <!-- This code will create a hyperlink to jump directly on the said chapter--> <xsl:attribute name="href"> <xsl:value-of select="concat(concat('#',.),./@L)"/> </xsl:attribute> <xsl:value-of select="."/><xsl:text> </xsl:text> </a> </xsl:for-each> </td> </tr> </xsl:for-each> </table> </xsl:if></xsl:template>\[/code\]I am missing something (might be much more) to get the required output!!
 
Back
Top