Disable output escaping on the copy-of, i.e. <xsl:copy-of select="expression" disable-output-escaping="yes" />
views:
345answers:
3
+2
A:
I would recommend using a dedicated template:
<!-- check if lower-casing @Type is really necessary -->
<xsl:template name="BookingComments[lower-case(@Type)='ram']/@comment">
<p>
<xsl:value-of select="." disable-output-escaping="yes" />
</p>
</xsl:template>
This way you could simply apply templates to the attribute. Note that disabling output escaping has the potential to generate ill-formed output.
Tomalak
2010-02-22 12:10:29
@Tomalak thank you very much! This does the trick.
DashaLuna
2010-08-16 13:17:31
A:
You could bind an extension function parse() which parses a string into a nodeset. The exact mechanism will depend on your XSLT engine.
In Xalan, we can take the following static method:
public class MyExtension
{
public static NodeIterator Parse( string xml );
}
and use it like so:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:java="http://xml.apache.org/xalan/java"
exclude-result-prefixes="java"
version="1.0">
<xsl:template match="BookingComments">
<xsl:copy-of select="java:package.name.MyExtension.Parse(string(@comment))" />
</xsl:template>
</xsl:stylesheet>
Lachlan Roche
2010-02-22 12:27:39