This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: foreign characters in params passed to stylesheet


> An XSLT processor is at liberty to use character references for any
> character in the output file, rather than using the native character.
> There's nothing in the spec that prevents this, and any XML
> parser (or HTML
> user agent) will treat the character reference and the native character
> identically.

There is one notable exception to this--whitespace character references
other than #x20 (space) in attribute values, namely #xD, #xA, and #x9.

"Note that if the unnormalized attribute value contains a character
reference to a white space character other than space (#x20), the normalized
value contains the referenced character itself (#xD, #xA or #x9). This
contrasts with the case where the unnormalized value contains a white space
character (not a reference), which is replaced with a space character (#x20)
in the normalized value..."[1]

For example, using a new XSLT 2.0 construct, we can see the difference in
behavior very clearly:

<xsl:value-of select="(1,2,3)" separator="
"/>

will output:

1 2 3

whereas this:

<xsl:value-of select="(1,2,3)" separator="&#xA;"/>

will output:

1
2
3

In the first case, the XML parser reads the attribute value as the space
character #x20 (according to attribute value normalization rules), and in
the second example the XML parser reads the attribute value as the line feed
character #xA. Note that serialization algorithms are also required to make
this distinction in order to correctly round-trip attribute values.

Evan

[1] http://www.w3.org/TR/REC-xml#AVNormalize


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]