Re: [newbie]   in xslt-file

Subject: Re: [newbie]   in xslt-file
From: Mike Brown <mike@xxxxxxxx>
Date: Wed, 1 Nov 2000 18:20:01 -0400 (EST)
Vincent De Baere wrote:
> [cut-'n-no-paste]
> <xsl:template match="article/b2/tekst">
> <tr><td>&nbsp;&nbsp;&nbsp;</td>
> <td><xsl:value-of select="./@author"/></td>
> <td>&nbsp;&nbsp;&nbsp;</td></tr>
> </xsl:template>
> [cut-'n-no-paste]
> However, this does not work. The parser (msxml3.dll) gives an error ("the
> stylesheet does not contain a document element. 

There should at least be an xsl:stylesheet element enclosing the template,
where you declare the binding of the xsl prefix to the appropriate
namespace for XSLT 1.0, and include the appropriate version attribute.

There should also be a prolog where you declare that the document is in
the XML 1.0 syntax, in a particular encoding.

> I tought the &nbsp; entity was predefined in xml. 

It is not predefined. Only &lt; &gt; &amp; &quot; &apos; are predefined.
You can either use &#160; or &#xA0;, or you can define an entity like nbsp
for the same.


<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#160;"> ]>
<xsl:stylesheet xmlns=""; version="1.0">
  <xsl:template match="article/b2/tekst">
        <xsl:value-of select="./@author"/>

See also the FAQs at

and.. er.. it seems the other XSL FAQ has disappeared.

   - Mike
Mike J. Brown, software engineer at         My XML/XSL resources: in Denver, Colorado, USA 

 XSL-List info and archive:

Current Thread