> I'm having trouble processing the end of line character ( ) > with XSLT. Here is my testcase :
U+0020 is not the end-of-line character. > <xsl:template match="/"> > <xsl:if test="contains(exsl-common:node-set($var1)/a/text(),'&EOL;')"> > <xsl:message>Contains EOL(1)</xsl:message> > </xsl:if> > <xsl:if test="contains(exsl-common:node-set($var2)/a/text(),'&EOL;')"> > <xsl:message>Contains EOL(2)</xsl:message> > </xsl:if> > </xsl:template> This is because of attribute value normalization: http://www.w3.org/TR/2004/REC-xml11-20040204/#AVNormalize The second parameter to the contains() function is being normalized from U+000A to U+0020, so by the time the XSLT processor sees the test attribute, it sees a string with a single space character as the second parameter. Try the following template instead of yours: <xsl:template match="/"> <xsl:if test="contains(exsl-common:node-set($var1)/a/text(),'&EOL;')"> <xsl:message>Contains EOL(1)</xsl:message> </xsl:if> <xsl:if test="contains(exsl-common:node-set($var2)/a/text(),'&EOL;')"> <xsl:message>Contains EOL(2)</xsl:message> </xsl:if> <xsl:if test="contains(exsl-common:node-set($var1)/a/text(),'
')"> <xsl:message>Contains EOL(3)</xsl:message> </xsl:if> <xsl:if test="contains(exsl-common:node-set($var2)/a/text(),'
')"> <xsl:message>Contains EOL(4)</xsl:message> </xsl:if> </xsl:template> which results in the following output: file:///V:/test/Stephen/test1.xsl; Line #32; Column #23; Contains EOL(2) file:///V:/test/Stephen/test1.xsl; Line #35; Column #23; Contains EOL(3) file:///V:/test/Stephen/test1.xsl; Line #38; Column #23; Contains EOL(4) <?xml version="1.0" encoding="UTF-8"?> I think you are either confused about attribute value normalization, or how entities work. Dave
