473,387 Members | 1,501 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

xsl not transforming correctly

I am an XSL newbie and this is my first XSL example. It does not render
any rows in the table. It only shows the table header row with the
column lables; no data rows. Please guide me.

XML FILE
========
<?xml version="1.0" encoding="ISO8859-1" ?>
<?xml-stylesheet type="text/xsl" href="booklist.xsl"?>
<BOOKLIST>
<BOOK>
<TITLE>Programming in the key of C#</TITLE>
<AUTHOR>Charles Petzold</AUTHOR>
<PUBLISHER>Microsoft Press</PUBLISHER>
</BOOK>

<BOOK>
<TITLE>Code: the hidden language of computer hardware and
software</TITLE>
<AUTHOR>Charles Petzold</AUTHOR>
<PUBLISHER>Microsoft Press</PUBLISHER>
</BOOK>

<BOOK>
<TITLE>Applied Microsoft .NET Framework Programming</TITLE>
<AUTHOR>Jeffrey Richter</AUTHOR>
<PUBLISHER>Microsoft Press</PUBLISHER>
</BOOK>
<BOOK>
<TITLE>CDO and MAPI Programming in Visual Basic</TITLE>
<AUTHOR>Dave Grundgieger</AUTHOR>
<PUBLISHER>O'reilly</PUBLISHER>
</BOOK>

<BOOK>
<TITLE>Moving from VB to VB.NET: concepts and strategies</TITLE>
<AUTHOR>Dan Appleman</AUTHOR>
<PUBLISHER>A-press</PUBLISHER>
</BOOK>
</BOOKLIST>


XSL FILE
=========
<?xml version="1.0" encoding="ISO8859-1" ?>
<xsl:stylesheet xmlns:xsl="http://w3.org/TR/WD-xsl">
<xsl:template match="/">
<HTML>
<BODY>
<TABLE border="1" background-color="blue">
<TH>
<TD>Title</TD>
<TD>Author</TD>
<TD>Publisher</TD>
</TH>

<xsl:for-each select="BOOKLIST/BOOK">
<TR>
<TD><xsl:value-of select="TITLE"/></TD>
<TD><xsl:value-of select="AUTHOR"/></TD>
<TD><xsl:value-of select="PUBLISHER"/></TD>
</TR>
</xsl:for-each>
</TABLE>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>

Aug 29 '06 #1
2 1166
"Water Cooler v2" <wt*****@yahoo.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
>I am an XSL newbie and this is my first XSL example. It does not render
any rows in the table. It only shows the table header row with the
column lables; no data rows. Please guide me.

XML FILE
========
<?xml version="1.0" encoding="ISO8859-1" ?>
<?xml-stylesheet type="text/xsl" href="booklist.xsl"?>
<BOOKLIST>
<BOOK>
<TITLE>Programming in the key of C#</TITLE>
<AUTHOR>Charles Petzold</AUTHOR>
<PUBLISHER>Microsoft Press</PUBLISHER>
</BOOK>

<BOOK>
<TITLE>Code: the hidden language of computer hardware and
software</TITLE>
<AUTHOR>Charles Petzold</AUTHOR>
<PUBLISHER>Microsoft Press</PUBLISHER>
</BOOK>

<BOOK>
<TITLE>Applied Microsoft .NET Framework Programming</TITLE>
<AUTHOR>Jeffrey Richter</AUTHOR>
<PUBLISHER>Microsoft Press</PUBLISHER>
</BOOK>
<BOOK>
<TITLE>CDO and MAPI Programming in Visual Basic</TITLE>
<AUTHOR>Dave Grundgieger</AUTHOR>
<PUBLISHER>O'reilly</PUBLISHER>
</BOOK>

<BOOK>
<TITLE>Moving from VB to VB.NET: concepts and strategies</TITLE>
<AUTHOR>Dan Appleman</AUTHOR>
<PUBLISHER>A-press</PUBLISHER>
</BOOK>
</BOOKLIST>


XSL FILE
=========
<?xml version="1.0" encoding="ISO8859-1" ?>
<xsl:stylesheet xmlns:xsl="http://w3.org/TR/WD-xsl">
<xsl:template match="/">
<HTML>
<BODY>
<TABLE border="1" background-color="blue">
<TH>
<TD>Title</TD>
<TD>Author</TD>
<TD>Publisher</TD>
</TH>

<xsl:for-each select="BOOKLIST/BOOK">
<TR>
<TD><xsl:value-of select="TITLE"/></TD>
<TD><xsl:value-of select="AUTHOR"/></TD>
<TD><xsl:value-of select="PUBLISHER"/></TD>
</TR>
</xsl:for-each>
</TABLE>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>
Dear Cooler

You are trying to use an outdated and obsolete pre-cursor to XSLT as shown
in the namespace "http://w3.org/TR/WD-xsl", (the WD stands for working
draft, I believe). This is only supported by early versions of MSXML and you
will find little or no documentation and support for it.
Change to the newer namespace of http://www.w3.org/1999/XSL/Transform.
You will find many examples of creating tables in HTML from raw XML online
or you can buy one of Michael Kay's excellent tomes.
I believe the example you have should work if you change the namespace as
outlined above, if you are still struggling let us know.

--

Joe Fawcett (MVP - XML)

http://joe.fawcett.name
Aug 29 '06 #2
Water Cooler v2 wrote:
I am an XSL newbie
Newbie? I'm increasingly beginning to think you're an out-an-out
Troll.

Learn to web search. Get some decent references that are less than 5
years old. Stop asking the most blindingly stupid questions, on any
topic, that it's just about possible to think up.

Aug 29 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Daniel Crespo | last post by:
Is there a built-in method for transforming (1,None,"Hello!") to 1,None,"Hello!"? Thanks
4
by: Showjumper | last post by:
I am using the NITF DTD for my xml files and i need to use 2 xsl files to do the transform: one for the <body.head> and the second for the <body.content>. I've got this so far for transforming...
3
by: Sergio Otoya | last post by:
Hi all, I need to transform an xml document, using xsl to a HTML output. I can do this successfully using the XslTransform class as below: Dim oTrans As New XslTransform ...
4
by: Cathie | last post by:
Hi All, I am trying to get my style sheet to work. It works fine in IE but I can't get it to work in .net. Below is the function I use for transforming, where advancedOptionsFile is the path...
4
by: John Bowman | last post by:
Hi, I'm not certain this is the best place to post this, but here it goes. I'm trying to get spaces to work correctly when using the WebBrowser control. Basically, I've got a valid XML...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.