Re: [xsl] disable-output-escaping in xsl:attribute

Subject: Re: [xsl] disable-output-escaping in xsl:attribute
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 22 Oct 2004 11:13:40 +0300
At 2004-10-22 09:28 +0130, Stefan Borchert wrote:
I've got the following source:
<xsl:element name="span">
 <xsl:attribute name="title">
  <xsl:text disable-output-escaping="yes">G&auml;ste</xsl:text>
 </xsl:attribute>
 <xsl:text disable-output-escaping="yes">G&auml;ste</xsl:text>
</xsl:element>

Then I process it via PHP (and Sablotron 1.0) and it produces:
'<span title="G&amp;auml;ste">G&auml;ste</span>' instead of the expected
'<span title="G&auml;ste">G&auml;ste</span>'.

I would not expect what you say you are expecting.


Instead of getting any result, you should be getting an error because XSLT 1.0 Section 16.4 states "It is an error for output escaping to be disabled for a text node that is used for something other than a text node in the result tree."

You are not disabling output escaping for a text node.

Furthermore, you could more easily say:

<span title="G&#xe4;ste">G&#xe4;ste</span>

and get the equivalent emitted to your result. XSLT 1.0 does not give you control over the choice of output serialization syntax for entity references.

If you wanted your stylesheet to be more legible, you could have:

  <!DOCTYPE xsl:stylesheet
  [
  <!ENTITY auml "&#xe4;">
  ]>
  <xsl:stylesheet ....

<span title="G&auml;ste">G&auml;ste</span>

.... but still this gives no indication to the output syntax for the entity reference.

Are you trying to make your stylesheet easier to read, or are you trying to control the output syntax? If the latter, why are you trying to do so when the choice of syntax does not matter to a browser, as long as the processor has made an appropriate choice of syntax?

I hope this helps.

....................... Ken


-- 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 Legal business disclaimers: http://www.CraneSoftwrights.com/legal

Current Thread