[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

character entities in xsl(t) - specifically  

Subject: character entities in xsl(t) - specifically  
From: Jerry Ventura <jventura@xxxxxxxxxxxxxx>
Date: Wed, 19 Apr 2000 15:19:33 -0400
undeclared entity nbsp
Hi,

I have a question about using character entities in xsl - specifically
&nbsp;
I've seen previous posts about this, but I couldn't find a resolution (sorry
if this is a dupe).

Here's the setup - my xsl is pretty simple:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" />
<xsl:template match="*|/"><xsl:apply-templates/></xsl:template>
<xsl:template match="text()|@*"><xsl:value-of select="."/></xsl:template>

<xsl:template match="/">
<HTML>
  <HEAD/>
  <BODY>
    <H1>&nbsp; Some text</H1>
  </BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>

When I run this through a xslt processor (I'm using saxon 5.2), I get the
following error (I didn't attach the xml, I think its irrelevant in my
example):

D:\thinclient\src\html>java com.icl.saxon.StyleSheet req.xml sample1.xsl
Fatal error reported by XML parser: reference to undeclared entity (found
"nbsp"
)
  URL:    file:/D:/thinclient/src/html/sample1.xsl
  Line:   16
  Column: 13
Error preparing style sheet
reference to undeclared entity (found "nbsp")


So I change the nbsp in my xsl to #160, and all is well. The processor
converts #160 to nbsp, and my html is what I expect.


My question (finally) is:

Am I required to use #160 instead of nbsp in my xsl? For some reason, I get
the feeling that I can set the character entity set 

<!ENTITY % HTMLlat1 PUBLIC "-//W3C//ENTITIES Latin 1//EN//HTML"> %HTMLlat1;

and take advantage of <!ENTITY nbsp   CDATA "&#160;">. This way I don't have
to change nbsp. Am I way off the mark here? Could someone post an example,
or shed some light?

Thanks

 - Jerry


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.