-
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">
<xsl utput 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
-
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 <xsl utput> tag is not supported.
Hope this helps.
Darryl
-
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 <xsl utput> 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
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks