• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Reg XSLT View in Browser

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic