Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xsl help

Status
Not open for further replies.

Netskimmer

Programmer
Dec 2, 2005
2
US
Hi all,

I’m new to xml and I’m trying to learn it from a book I picked up awhile back called XML and Java from Scratch by Nicholas Chase. I have gotten to the point where he begins to discuss XSL but I can’t seem to get my browser to accept the code. He writes to create two files:

Test.xml

<?xml version='1.0'?>
<?xml:stylesheet type="text/xsl" href=test.xsl"?>
<document>
<message>
It worked!
</message>
</document>

And

Test.xsl

<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="
<xsl:template match="/">
<html>
<body>
<h1><xsl:value-of select="//message"/></h1>
</body>
</html>
</xsl:template>

</xsl:stylesheet>

Then open test.xml in the browser. If the browser is properly set up it should show “It worked” in large letters as if you had used a css file but all I get is an element tree and a message that the xml document appears to have no style information. If this happens he writes to install MSXML3. I have done this but it still does not display properly. Any idea what I an doing wrong?
 
Can you discover there is a typo in this line?
>[tt]<?xml:stylesheet type="text/xsl" href=test.xsl"?>[/tt]
 
Yes, it should be <?xml-stylesheet type="text/xsl" href=test.xsl"?>
It’s a typo in the book, I fixed it by looking at later examples and noticed the difference. Thanks for the help tsuji.
 
>Yes, it should be <?xml-stylesheet type="text/xsl" href=test.xsl"?>
>It’s a typo in the book.

Not only that! it is mainly the href which breaks thing down!
[tt] <?xml[highlight]-[/highlight]stylesheet type="text/xsl" href=[COLOR=red yellow]"[/color]test.xsl"?>[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top