[Home] [By Thread] [By Date] [Recent Entries]
Anne Kootstra wrote:
This only works on XSLT 2.0. In XSLT 1.0, you might try it like this (this is a non-generalized approach. Depending on your real input data, you may want other approaches): <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes"/> <xsl:template match="/A">
<table>
<xsl:apply-templates select="C" />
</table>
</xsl:template>
<xsl:template match="C[not(T)]">
<tr>
<xsl:apply-templates select="P" />
<td>*</td>
<xsl:apply-templates select="S" />
</tr>
</xsl:template>
<xsl:template match="C">
<tr>
<xsl:apply-templates select="*" />
</tr>
</xsl:template>
<xsl:template match="P|S|T">
<td><xsl:value-of select="."/></td>
</xsl:template>
</xsl:stylesheet>I tested the above template with your input. It gives the desired result (I used html tags, not sure if that's what you need). Cheers, Abel Braaksma Nuntia B.V.
|

Cart



