Subject: RE: RE: Transformation XML to XML
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 19 Jul 2005 15:46:53 +0100
|
This is just horrible. disable-output-escaping should never be used to
construct markup in the serialized output. And in this case, there's no
possible excuse because the correct code is dead easy:
><xsl:template match="z:row">
><xsl:text disable-output-escaping="no"><image></xsl:text>
><xsl:for-each select="@*">
<xsl:text disable-output-escaping="no"><</xsl:text>
<xsl:value-of select="name()"/>
<xsl:text disable-output-escaping="no">></xsl:text>
> <xsl:value-of select="."/>
> <xsl:text disable-output-escaping="no"></</xsl:text>
> <xsl:value-of select="name()"/>
> <xsl:text disable-output-escaping="no">></xsl:text>
></xsl:for-each>
><xsl:text disable-output-escaping="no"></image></xsl:text>
></xsl:template>
What's wrong with:
<xsl:template match="z:row">
<image>
<xsl:for-each select="@*">
<xsl:element name="{name()}">
<xsl:value-of select="."/>
</xsl:element>
</xsl:for-each>
</image>
</xsl:template>
Michael Kay
http://www.saxonica.com/
|