Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reg XSLT View in Browser

 
Karne Reddy
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,

Can anybody help me out in viewing or applying an xslt to a xml document.

Here is my xslt code.


<?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="/">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th>
<th>Artist</th>
</tr>
<tr>
<td>.</td>
<td>.</td>
</tr>
</table>
</body>
</html>
</xsl:template></xsl:stylesheet>


And I applied the above xslt doc to the following xml file
<?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML file generated by XMLSpy v2005 rel. 3 U (http://www.altova.com)-->
<?xml-stylesheet type=�text/xsl� href="employees.xsl�?>
<employees xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.employees.com/a employees.xsd" xmlns="http://www.employees.com/a">
<!-- <?xml-stylesheet type=�text/css� href="emp.css�?> -->


<employee position="manager">
<name>
<first>John</first>
<last>Dent</last>
</name>
<age>34</age>
</employee>

....


</employees>

In the browser I am not able to see the expected result.
I am getting the following thing in browser:

<?xml version="1.0" encoding="UTF-8" ?>
- <!-- Sample XML file generated by XMLSpy v2005 rel. 3 U (http://www.altova.com)
-->
<?xml-stylesheet type=�text/xsl� href="employees.xsl�?>
- <employees xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.employees.com/a employees.xsd" xmlns="http://www.employees.com/a">
- <!-- <?xml-stylesheet type=�text/css� href="emp.css�?>
-->
- <employee position="manager">
- <name>
<first>John</first>
<last>Dent</last>
</name>
<age>34</age>
</employee>

</employees>

Can anybody explain wat might be the reason?


----------
scjp, scwcd
 
vinay kumar
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No problem with the files except double quotes character (might be an editor problem in which you have typed in).

I replaced � with ". Opened in IE. Displayed a table with the given header colours.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic