LISTSERV mailing list manager LISTSERV 15.5

Help for XML-L Archives


XML-L Archives

XML-L Archives


View:

Next Message | Previous Message
Next in Topic | Previous in Topic
Next by Same Author | Previous by Same Author
Chronologically | Most Recent First
Proportional Font | Monospaced Font

Options:

Join or Leave XML-L
Reply | Post New Message
Search Archives


Subject: Re: Creating entities with XSL 19990813
From: "G. Ken Holman" <[log in to unmask]>
Reply-To:General discussion of Extensible Markup Language <[log in to unmask]>
Date:Mon, 20 Sep 1999 14:32:36 -0400
Content-Type:text/plain
Parts/Attachments:
Parts/Attachments

text/plain (75 lines)


At 99/09/20 09:23 -0400, I wrote:
> From what I can tell, everything you need for HTML is already at hand,
>without needing to add a prefix:entity-ref at all.

I have stood all this time on my soapbox stating how XSLT already provides
all the recommended methods of getting you the &nbsp; reference in your
HTML file through proper markup techniques, and how you have no need to
hand-craft entity references in your output file.

What I haven't told you, but probably should, is that there *is* indeed a
way for you to do what you want *if* the XSLT engine has chosen to support
a feature of XSLT-19990813 that allows you to disable the output escaping
defined by the given output method.

But, and I repeat BUT(!!), this is not very portable since an XSLT engine
is not obliged to support the feature.  Sitting in an ivory tower, it might
be considered not "right" since it gives a user enough rope to hang
themselves by allowing them to subvert the protections built in when using
the markup languages properly.

However, given that both XML and HTML escape the ampersand by putting out
"&amp;" for what you need, this can be disabled such that the XSLT engine
actually emits "&" instead of "&amp;".  Note that when the output method is
text there isn't any escaping going on in the first place.

Attached below (with the HTML document element modified to not screw up my
mailer) is an example of how to subvert the protection of using entity
references.  It happens that XT does implement this optional feature.

I hope this helps to understand the situation, but I also hope I've
convinced you earlier that the other ways I showed how to do this are the
"better" ways to do this.

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


X:\samp>sed s/html/hmtl/g disable.xsl
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0">

<xsl:output method="hmtl" indent="yes"/>

<xsl:template match="/">                    <!--root rule-->
  <hmtl>
   <body>
    <p>
     <xsl:text>This is an nbsp reference: '</xsl:text>
     <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
     <xsl:text>'.</xsl:text>
    </p>
   </body>
  </hmtl>
</xsl:template>

</xsl:stylesheet>

X:\samp>call xsl disable.xsl disable.xsl disable.htm
X:\samp>sed s/html/hmtl/g disable.htm
<!DOCTYPE hmtl PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<hmtl>
<body>
<p>This is an nbsp reference: '&nbsp;'.</p>
</body>
</hmtl>

X:\samp>

--
G. Ken Holman                    mailto:[log in to unmask]
Crane Softwrights Ltd.             http://www.CraneSoftwrights.com/l/
Box 266, Kars, Ontario CANADA K0A-2E0   +1(613)489-0999   (Fax:-0995)
Website:  XSL/XML/DSSSL/SGML services, training, libraries, products.
Practical Transformation Using XSLT and XPath      ISBN 1-894049-01-2
Next instructor-led training:  1999-09-24, 1999-11-08, 1999-12-05/06,
                              1999-12-07, 2000-02-27/28, 2000-05-11/12

Back to: Top of Message | Previous Page | Main XML-L Page

Permalink



LISTSERV.HEANET.IE

CataList Email List Search Powered by the LISTSERV Email List Manager