Re: [xsl] amp symbols

Subject: Re: [xsl] amp symbols
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 4 Jul 2006 00:01:13 +0100
> ? Also, the one issue  
> that I am running into is the fact that if I try to put an entity  
> symbol into the file such as &test; when I process the file, it  
> converts it to &amp;test;. 

Your input must have also been &amp;test; (or <![CDATA[&test;]]> wich is
the same thing, as otherwise you'd have an undefined entity error in the
stylesheet.

If your processor supports d-o-e then
<xsl:text disable-output-escaping="yes">&amp;test;</xsl:text>
will produce what you want, but a system is allowed to silently ignore
d-o-e and then gove you &amp;test; so perhaps that is what you are
seeing. (Which processor are you using?)

> It's like it won't allow me to use the &  
> symbol even when using it in the name of the entity.

An XSL file has to be well formed XML so that means that either & has to
be used as the start of a character or entity reference, or it has to
be quoted or equivalently in a CDATA section. If it's used as an entity
reference delimiter then teh entity must be defined in the stylesheet,
but XSLT will not see the entity, it will be resolved by the XML parser
before XSLT starts. If you use a quted amp then that is what you get in
the result unless you turn off the escaping in teh result tree with the
d-o-e attribute.

If it makes you feel any better, you're not the first person to go
through this loop. Including, er, "at least one" of the people
responding in the current thread...

First hit that I get for
http://www.google.com/search?q=xsl-list+carlisle+mathml+++CDATA+entity
may look vaguely familiar...

http://www.biglist.com/lists/xsl-list/archives/199901/msg00032.html

David

Current Thread