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: Output is incorrect...


I don't think the root element is correct in your xml page.  you've got <cat
name=> then inside that you've got <cat name=> and another <cat name=>
did you try changing the root to cats so that the other cat elements become
elements of that?





-----Original Message-----
From: owner-xsl-list@mulberrytech.com
[mailto:owner-xsl-list@mulberrytech.com]On Behalf Of Peter McEvoy
Sent: Friday, September 29, 2000 12:46 PM
To: XSL-List@mulberrytech.com
Subject: Output is incorrect...


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


 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]