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.

Try:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#160;"> ]>
<xsl:stylesheet xmlns="http://www.w3.org/1999/XSL/Transform"; version="1.0">
  <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>
</xsl:stylesheet>


See also the FAQs at

http://www.netcrucible.com/xslt/msxml-faq.htm

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

   - Mike
____________________________________________________________________
Mike J. Brown, software engineer at         My XML/XSL resources:
webb.net in Denver, Colorado, USA           http://www.skew.org/xml/




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


Current Thread