Hi --
Are there any special rules around XSLT processing of string values from
attributes vs text() nodes? I've noticed the libxslt seems to strip out
carriage returns. CRs are probably pretty rare in attribute values, but
MSXML seems to handle them ok so I'm wondering if there any special
rules I don't know about. I took a quick look through the XSLT spec and
didn't seen anything.
Here's how to reproduce it. Given this XML:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="U:\Active
Workspace\Development\IKRS\CentralClassifier\libxslt-bug.xslt"?>
<libxml>
<foo a="alpha
beta
delta"/>
</libxml>
and this stylesheet:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="foo">
<attribute><xsl:value-of select="@a"></xsl:value-of></attribute>
</xsl:template>
</xsl:stylesheet>
MSXML produces:
<?xml version="1.0" encoding="UTF-8"?>
<attribute>alpha
beta
delta</attribute>
whereas libxslt produces:
<?xml version="1.0" encoding="UTF-8"?>
<attribute>alpha beta delta</attribute>
Any ideas?
Thanks!
Ramon