Re: XSL and entities

Subject: Re: XSL and entities
From: James Clark <jjc@xxxxxxxxxx>
Date: Mon, 21 Sep 1998 11:56:37 +0700
Philippe Le Hégaret wrote:

> Here is an example of this element:
> 
> <code>
> &lt;!ELEMENT paragraph (#PCDATA)*>
> 
> &lt;!ELEMENT item (paragraph)+>
> 
> &lt;!ELEMENT list (item)+>
> &lt;!ATTLIST list
>         type (ordered|unordered) "unordered">
> </code>
> 
>   Now, I want to transform this document in LaTeX,
> and HTML.

> html.xsl:
>     <xsl:template match='code'>
>     <pre>
>       <xsl:process-children/>
>     </pre>
>     </xsl:template>
> 
>   The problem appears during the HTML transformation.
> It produces this result :
>           <pre>
> <!ELEMENT paragraph (#PCDATA)*>
> 
> <!ELEMENT item (paragraph)+>
> 
> <!ELEMENT list (item)+>
> <!ATTLIST list
>         type (ordered|unordered) "unordered">
>     </pre>

This is a bug in your XSL processor.  It should produce

          <pre>
&lt;!ELEMENT paragraph (#PCDATA)*>

&lt;!ELEMENT item (paragraph)+>

&lt;!ELEMENT list (item)+>
&lt;!ATTLIST list
        type (ordered|unordered) "unordered">      
    </pre>

or something equivalent.

Here's the relevant part of the XSL WD:

Processing a character in the source tree adds the character to the
result tree. Note that this works at the tree level. Thus,
markup of &lt; in content will be represented by a character < in the
source tree which will, with the built-in template rules,
turn into a < character in the result tree, which would be represented
by the markup &lt; (or an equivalent character
reference) when the result tree is externalized as an XML document.

James



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


Current Thread