This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [newbie]   in xslt-file


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   out of it.
>
>I tought the   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   entity is not predefined in XML.  The only entities that are are
<, >, &, " and '.  To define the   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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]