Peter Nabbefeld schrieb:
Hello,

I want to transform sth. like this:
<input value="My &quot; text"/>

The translation results in this:
<input value="My &amp;quot; text">

Moin Peter,

there must be something going on in your transformation that alters the
input *text* from {"} to {&quot;}. Note that &quot; as (built-in) entity
reference is equivalent to a literal double-quote.

Maybe the change occurs later, on the way to your output device
(display), maybe only in appearance. Give it a try on the command line.

# xalan apos.xml identity.xsl
<?xml version="1.0" encoding="UTF-8"?><input value="My &quot; text"/>

# xalan apos.xml identity-html.xsl
<input value="My &quot; text">

I know, the spec says: "The html output method may output a character
using a character entity reference, if one is defined for it in the
version of HTML that the output method is using.", but this doesn't
help me.

The entity reference you're seeing is built into XML. It is necessary in
this case to allow a double-quote to appear in attribute content when
double-quotes are picked as attribute delimiter.

Is it possible to switch off this behaviour? At least for numerical
entities, like &#x22;?

Technically, that's not an entity reference, but a numerical character
reference. (Numerical character references just happen to use the same
syntax as entity references.)

(1) You'll see numerical character references whenever your output
contains characters that can not be represented in your chosen output
encoding. Try using xsl:output/@encoding = 'US-ASCII' and transforming
Käsekuchen.

An alternative to outputting numerical character references here would
be failure to transform.

Use xsl:output/@encoding = 'UTF-8' if you want to exclude any need for
the serializer to resort to numerical character references.

(2) You may see character entity references as per the part of the spec
you quoted from (16.2 HTML Output Method).

Hope this helps.

Michael Ludwig

Reply via email to