Is There Any Way Of Getting Webkit's Javascript To Handle Whitespace Properly?
It turns out webkit doesn't appear to behave particularly well with whitespace while processing an XSLT. It seems to treat newline, carriage returns, tabs and spaces equally, even
Solution 1:
I can't reproduce that problem with Safari 5.0.3. Test case (XML document loaded in browser window):
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="test2011012801Xsl.xml"?><test>foo bar</test>
where the stylesheet is
<xsl:stylesheetxmlns:xsl="http://www.w3.org/1999/XSL/Transform"version="1.0"><xsl:templatematch="/"><html><head><title>Test</title></head><body><xsl:apply-templates/></body></html></xsl:template><xsl:templatematch="test"><p><xsl:value-ofselect="string-length(substring-after(., ' '))"/></p></xsl:template></xsl:stylesheet>
Output in both Firefox (3.6) and Safari on Windows is "0". So at least with that test there is no evidence that a space character in a text node is treated as a newline character.
Post a Comment for "Is There Any Way Of Getting Webkit's Javascript To Handle Whitespace Properly?"