Subject: Re: [xsl] Carriage returns in attribute values (poss libxslt bug)? From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Wed, 21 Apr 2004 07:37:24 +0200 |
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>
-- Public courses: Spring 2004 world tour of hands-on XSL instruction Each week: Monday-Wednesday: XSLT/XPath; Thursday-Friday: XSL-FO Hong Kong May 17-21; Bremen Germany May 24-28; Helsinki June 14-18
World-wide on-site corporate, govt. & user group XML/XSL training. G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Carriage returns in attribute, Ramon M. Felciano @ | Thread | Re: [xsl] Carriage returns in attri, David Carlisle |
RE: [xsl] for-each loops : calculat, Kenny Akridge | Date | [xsl] Excluding too much in nested , Ragulf Pickaxe |
Month |