Problem using XSL from IE -- works with DOM in VB


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Problem using XSL from IE -- works with DOM in VB

  1. #1
    Paul Klanderud Guest

    Problem using XSL from IE -- works with DOM in VB


    I'm getting different results when I run an XSL style sheet against an xml
    document using the DOM API from within VB (where it works correctly), and
    then simply trying to reference the stylesheet from within my xml document
    and loading it in IE (version 5.0).

    I'm not sure if I'm not referring to the XSL correctly from my xml document,
    or if what I'm trying to do isn't supported by my version of IE (5.0), or
    if it's something else entirely.

    This is the very simple xml:

    <?xml version="1.0"?>
    <products>
    <product>Quake</product>
    <product>Windows 2000</product>
    <product>Cooking Light</product>
    <product>Turbo Tax</product>
    </products>

    And this is the XSL:

    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xslutput method="xml" indent="yes" />
    <xsl:template match="/">
    <HTML>
    <BODY>
    <TABLE border="1">

    <xsl:for-each select="/products/product">
    <TR>
    <TD>Name</TD>
    <TD><xsl:value-of select="."/></TD>
    </TR>
    </xsl:for-each>

    </TABLE>
    </BODY>
    </HTML>
    </xsl:template>
    </xsl:stylesheet>

    When using the DOM from VB, it works fine and produces this:

    <?xml version="1.0" encoding="UTF-16"?>
    <HTML>
    <BODY>
    <TABLE border="1">
    <TR>
    <TD>Name</TD>
    <TD>Quake</TD>
    </TR>
    <TR>
    <TD>Name</TD>
    <TD>Windows 2000</TD>
    </TR>
    <TR>
    <TD>Name</TD>
    <TD>Cooking Light</TD>
    </TR>
    <TR>
    <TD>Name</TD>
    <TD>Turbo Tax</TD>
    </TR>
    </TABLE>
    </BODY>
    </HTML>


    So that works fine. But when I modify the xml to include a reference (not
    sure of the right term here) to the style sheet so that the xml looks like
    this and simply try to load it in IE (instead of running it through my VB
    app:

    <?xml version="1.0"?>
    <!-- with stylesheet -->
    <?xml:stylesheet type="text/xsl" href="products_table.xsl"?>

    <products>
    <product>Quake</product>
    <product>Windows 2000</product>
    <product>Cooking Light</product>
    <product>Turbo Tax</product>
    </products>

    ... the only output I get is a single-rowed and single-celled table with
    one data value, "Name".

    Can anyone steer me in the right direction?

    Thanks for your help,
    Paul




  2. #2
    Darryl Guest

    Re: Problem using XSL from IE -- works with DOM in VB



    Hey Paul, IE uses an old xsl namespace, which is not a standard. Thus, some
    xsl tags are
    not supported and others do not function as they should.

    Your stylesheet must declare the old namespace:
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl" version="1.0">

    not the current one.

    You will find that under this namespace, the <xslutput> tag is not supported.

    Hope this helps.

    Darryl


  3. #3
    Paul Klanderud Guest

    Re: Problem using XSL from IE -- works with DOM in VB


    Darryl,

    Thanks much -- it worked perfectly once I changed the namespace and removed
    the output tag.

    This was driving me crazy! I actually had no idea that the namespace definitions
    were that important -- I thought they were more of a formality that never
    really got interpreted ... guess that is not correct.

    Thanks again!
    Paul

    "Darryl" <darryl.mccool@nurun.com> wrote:
    >
    >
    >Hey Paul, IE uses an old xsl namespace, which is not a standard. Thus, some
    >xsl tags are
    >not supported and others do not function as they should.
    >
    >Your stylesheet must declare the old namespace:
    ><xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl" version="1.0">
    >
    >not the current one.
    >
    >You will find that under this namespace, the <xslutput> tag is not supported.
    >
    >Hope this helps.
    >
    >Darryl
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center