aspose file tools*
The moose likes Product and Other Certifications and the fly likes What's wrong with it? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Product and Other Certifications
Bookmark "What Watch "What New topic
Author

What's wrong with it?

Himal Chuli
Ranch Hand

Joined: Aug 06, 2002
Posts: 118
hi all,
i've the following xml file:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<?xml-stylesheet type="text/xsl" href="cdcatalog.xsl"?>
<!-- Edited with XML Spy v4.2 -->
<catalog>
<cd>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
<catalog>
here is the "cdcatalog.xsl"
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:value-of select="catalog/cd/title"/>
</xsl:template>
</xsl:stylesheet>
i am expecting to get "Empire Burlesque" but got nothing at all. can anybody point out what's wrong with it?
thanks.
himal


Himal
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1180
Works for me with XML Spy 4.4!
The closing tag of catalog is not right.
Cheers,
Dan


William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
Jayadev Pulaparty
Ranch Hand

Joined: Mar 25, 2002
Posts: 662
Himal,
I'm using xalan xslt processor and getting the following output -
<?xml version="1.0" encoding="UTF-8"?>
Empire Burlesque
Also, you need to close the xml document properly with </catalog> (a little typo in ur pasted code)
Do you want to just see "Empire Burlesque" and not even the <?xml....?> stuff??
Jayadev Pulaparty
Ranch Hand

Joined: Mar 25, 2002
Posts: 662
Dan,
Any idea as to how to get rid of this <?xml...?> stuff from the output; I guess the processor is sticking it out there and even has nothing to do with PI node as this is not a PI.
Jayadev Pulaparty
Ranch Hand

Joined: Mar 25, 2002
Posts: 662
I'm seeing this stuff -
<?xml version="1.0" encoding="UTF-8"?>
when i open it in a notepad and not the IE.
Himal Chuli
Ranch Hand

Joined: Aug 06, 2002
Posts: 118
thanks for you guys' prompt reply. looks like i don't have xslt processor installed and i didn't know that i should have it. i just tried opening that xml file in IE5 browser and got nothing.
appreciate it if you guys suggest me the processor that i should install and the place that i can download it. pls also point out the steps to install it.
thanks again for your help.
himal
Jayadev Pulaparty
Ranch Hand

Joined: Mar 25, 2002
Posts: 662
Himal,
You can get Apache's Xalan-Java xslt processor here -
http://xml.apache.org/xalan-j/
Read the instructions there as to how to install it and make sure that you got everything right after setting all the CLASSPATH variables properly by running the command (from a msdos prompt)
java org.apache.xalan.xslt.Process
All this stuff is given in there.
The reason why it failed to open the xml file in IE for you is the missing / for the closing catalog tag as Dan pointed out; Also you should have the xsl file in the same directory as your xml so that IE can apply the stylesheet on ur xml document and show you the result in IE.
Gobiraj Vadivelrajan
Greenhorn

Joined: Dec 10, 2001
Posts: 29
IE5 uses a old XSLT Namespace.
Change the namespace to http://www.w3.org/TR/WD-xsl and it will work
Jayadev Pulaparty
Ranch Hand

Joined: Mar 25, 2002
Posts: 662
Gobiraj,
I think he is mainly having problem with the closing "/" tag for his catalog element. I could see the resulting xml after the xsl transformation in IE6 with the old namespace http://www.w3.org/1999/XSL/Transform.
Gobiraj Vadivelrajan
Greenhorn

Joined: Dec 10, 2001
Posts: 29
Check this website also for the namespace problem in IE5
http://www.javertising.com/webtech/xmlnames.asp
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1180
Jayadev,
Any idea as to how to get rid of this <?xml...?> stuff from the output;

should do it.
Jayadev Pulaparty
Ranch Hand

Joined: Mar 25, 2002
Posts: 662
Thanks Dan.
 
Consider Paul's rocket mass heater.
 
subject: What's wrong with it?