T. Sander wrote:
> I have the following XML-fragment :
>
> <DL>
> <DT>term 1 </DT>
> <DD>def 1</DD>
> <DT>term 2 </DT>
> <DD>def 2</DD>
> <DT>term 3 </DT>
> <DD>def 3</DD>
> </DL>
>
> and want to generate a table similar to :
>
> <html>
> <body>
> <table border="12">
> <TR>
> <TD>term 1</TD>
> <TD>def 1</TD>
> </TR>
> <TR>
> <TD>term 2</TD>
> <TD>def 2</TD>
> </TR>
> <TR>
> <TD>term 3</TD>
> <TD>def 3</TD>
> </TR>
> </table>
> </body>
> </html>
>
> So I am looking for a xsl template to generate this HTML table
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns

sl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl

utput method="html" indent="yes" encoding="UTF-8" />
<xsl:template match="/">
<html>
<head>
<title>Some definitions</title>
</head>
<body>
<xsl:apply-templates select="DL" />
</body>
</html>
</xsl:template>
<xsl:template match="DL">
<xsl:if test="DT">
<table border="12">
<tbody>
<xsl:for-each select="DT">
<tr>
<td><xsl:value-of select="." /></td>
<td><xsl:value-of select="following-sibling:

D[1]" /></td>
</tr>
</xsl:for-each>
</tbody>
</table>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
--
Martin Honnen
http://JavaScript.FAQTs.com/