XSLT special characters
Posted
by Apurv
on Stack Overflow
See other posts from Stack Overflow
or by Apurv
Published on 2010-05-28T00:53:12Z
Indexed on
2010/05/28
1:01 UTC
Read the original article
Hit count: 225
In the following XSL transformation how do I output the '<' and '>' symbol?
Input XML:
<TestResult bugnumber="3214" testname="display.methods::close->test_ManyInvoke" errortype="Failure"><ErrorMessage><![CDATA[calling close() method failed - expected:<2>]]></ErrorMessage>
XSLT:
<xsl:template match="TestResult">
<xsl:variable name="errorMessage">
<xsl:value-of select="ErrorMessage" disable-output-escaping="yes"/>
</xsl:variable>
<Test name='{@testname}'>
<TestResult>
<Passed>false</Passed>
<State>failure</State>
<Metadata>
<Entry name='bugnumber' value='{@bugnumber}' />
</Metadata>
<TestOutput>
<Metadata>
<Entry name='ErrorMessage' value='{$errorMessage}' />
</Metadata>
</TestOutput>
</TestResult>
</Test>
</xsl:template>
Output XML:
<Test name="display.methods::close->test_ManyInvoke">
<TestResult>
<Passed>false</Passed>
<State>failure</State>
<Metadata>
<Entry name="bugnumber" value="3214"/>
</Metadata>
<TestOutput>
<Metadata>
<Entry name="ErrorMessage" value="calling close() method failed - expected:<2>"/>
</Metadata>
</TestOutput>
</TestResult>
</Test>
© Stack Overflow or respective owner