This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
output escaping (i just dont get it)
- To: xsl-list at lists dot mulberrytech dot com
- Subject: [xsl] output escaping (i just dont get it)
- From: "McKeever, Marty" <marty dot mckeever at bankofamerica dot com>
- Date: Fri, 26 Oct 2001 09:16:25 -0400
- Reply-To: xsl-list at lists dot mulberrytech dot com
I found the "solution" to my question in this old thread,
http://www.biglist.com/lists/xsl-list/archives/200008/threads.html#00389
but i still dont quite understand what's going on here.
The scenario:
my template rule is
<h2><xsl:value-of select="$heading"/></h2>
where $heading is an external parameter being passed into the transformer
(xalan).
when heading == "This & That"
the output is <h2>This & That</h2>
and
when heading == "This & That"
the output is <h2>This &amp; That</h2>
So my real question is, why is the & 'legal' when passed as an external
parameter, when it would obviously be illegal as an internal param, ie:
<xsl:param name="heading">This & That</xsl:param> ??
I would have thought that all 'input' strings would have to be well-formed
for the transformation to take place.
And why is the & automaticaly converted to & in this situation, but not
others?
Anyway, to get the result that i wanted, i changed the rule as follows:
<h2><xsl:value-of select="$heading" disable-output-escaping="yes"/></h2>
so
when heading == "This & That"
the output is <h2>This & That</h2>
So now i am REQUIRED to use '&' in the param, because '&' throws the
well-formedness error i was expecting all along.
I just dont get WHY...
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list