I think there is a problem here in 6.5.2, which is fixed in 7.4. Although the spec doesn't say so explicitly, a tab character in an attribute value should probably be serialized as a character reference (	) not as a tab character, because the XML parser will convert a tab character to a space when you read the generated stylesheet back in.
If you can't move forward to 7.4, you could try fixing the code in XMLEmitter yourself to do this escaping.
A workaround is to generate
<xsl:variable name="TAB"><xsl:text>&#x9;</xsl:text></xsl:variable>
contains(str, $TAB)
which should work, because the XML parser won't normalize tabs appearing in element content, only in attributes.

Michael Kay
Software AG
home: Michael.H.Kay@ntlworld.com
work: Michael.Kay@softwareag.com

-----Original Message-----
From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of Ytai Ben-Tsvi
Sent: 10 April 2003 11:27
To: Saxon Help List
Subject: [saxon] XPath string escaping


I’m having a little trouble with string escaping in XPath string literals:


When I want to check whether a string contains a TAB character, I check whether contains(str,’&#9;’) and this works just fine, but what if I want to generate a target XSLT by another XSLT, where I want the TARGET to check for a TAB in its input? Neither contains(str,’&#9;’) nor contains(str,’&amp;#9;’) work. Any ideas?


Ytai  Ben-Tsvi

C T I Squared