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

Re: [newbie]   in xslt-file

Subject: Re: [newbie]   in xslt-file
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 2 Nov 2000 17:22:56 -0400 (EST)
xslt nbsp entity
Vincent,

>However, this does not work. The parser (msxml3.dll) gives an error ("the
>stylesheet does not contain a document element. The stylesheet may be empty,
>or it may not be a well-formed XML document"). The document appears to be OK
>when i leave the &nbsp; out of it.
>
>I tought the &nbsp; entity was predefined in xml. Does anyone know the
>numeric form of that character, or does anyone has other ideas why this does
>not work?

The &nbsp; entity is not predefined in XML.  The only entities that are are
&lt;, &gt;, &amp;, &quot; and &apos;.  To define the &nbsp; entity, include
the following in your DTD:

<!ENTITY nbsp '&#160;'>

Or of course you can use &#160; wherever you currently use &nbsp;.  I use
the HTML4.01 spec (from the W3C site) as my source of character references,
but there are plenty of other resources out there that list them.

The reason that MSXML reports a problem with the document element is that
the error is arising from the MSXSL processor, which is being passed a DOM
with no content, due to the fact that the document could not be parsed into
the DOM in the first place, because of the missing entity definition.  I
guess that you're using MSXML within some scripting (the parse error is
reported if you use MSXML in IE without scripting), in which case I
recommend that you add something like:

  XSLDOM.load(XSLfile);

  if (XSLDOM.parseError.errorCode != 0) {
    error = XSLDOM.parseError;
    alert('Error parsing XSLT file:\n' + error.reason + '[' + error.url + 
          ': line ' + error.line + ', col ' + error.linepos + ']');
    return;
  }

which will help you identify any well-formedness errors, like this one, in
the stylesheet.

Cheers,

Jeni

Jeni Tennison
http://www.jenitennison.com/




 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.