Output is incorrect...

Subject: Output is incorrect...
From: "Peter McEvoy" <peter.mcevoy@xxxxxxxx>
Date: Fri, 29 Sep 2000 18:46:01 +0100
I am writing a very simple application that converts XML  into HTML using an
XSL sheet  However, I am getting confusing output that I just do not exepect
to see.  I'd like to think I understand XSL sheets etc, but this is just
wierd.

The following sample XML file:

----------------------------------------------------------
<?xml version="1.0" encoding="US-ASCII" standalone="no" ?>

<!DOCTYPE cat SYSTEM
"file:///view/pete_devel/vob_minerva/htdocs/xml/categories.dtd">

<cat name="Top" id="_0">
   <cat name="Category level 1" id="_1">
      <art id="_123.456"> name="Test doc"</art>
      <art id="_123.457"> name="Test doc again"</art>
      <art id="_123.458"> name ="Another Test doc"</art>
      <art id="_123.459"> name="Last Test doc"</art>
      <art id="_123.459"> name="LAST Test doc"</art>

      <cat name="Category level 2" id="_2">
        <cat name="Category level 3.1" id="_3"/>
        <cat name="Category level 3.2" id="_4"/>
        <cat name="Category level 3.3" id="_5"/>
      </cat>
   </cat>
</cat>
------------------------------------------------------------
(hopefully this hasn't got too mangled by the mailer)

Ant the following XSL style sheet:

------------------------------------------------------------
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
         version="1.0"
         xmlns="http://www.w3.org/TR/REC-html40";>

<xsl:output method="html" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:param name="id"/>

<xsl:template match="cat[@id=$id]">
  <html>
  <body>
     <table border="1" width="95%">
        <tr>
           <td>
           <b>
           <xsl:value-of select="./@name"/>
           </b>
           </td>
        </tr>
     </table>
  </body>
  </html>
</xsl:template>

</xsl:stylesheet>
------------------------------------------------------------

(this is a very much simplified version of the actual stylesheet that I'm
developing, but it replicates the problem and cuts to the chase as it were.

So basically my problem is this.

when id=_0 (the parameter) is passed to the stylesheet, the output is as
expected, a HTML table that contains the text "Top".  Similarly for id=_1 -
the text is "Category Level 1".  However, when id=_2, I seem to get the
contents of the "art" nodes

Peter McEvoy
Senior Technical Analyst
IONA Technologies PLC


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


Current Thread