Learn XML stylesheet with example

There are lots of examples in the internet that help you to learn xml and stylesheet. You can make changes to the source xml file and see how it is changed in the result. Consider for example that you have an xml file like,

_______________________________________________


_______________________________________________

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="books_style.xsl"?>
<books>
<book>
<author>Author Name 1</author>
<title>Book Title 1</title>
</book>
.
.
.
</books>

If you look at the xml file given above you can see that it contains a list of books details with author of the book and the title of the book. There are many <book> nodes in it that has <author> and <title> child nodes. The second line of that xml file indicates the stylesheet which is used to format the data in the xml file. The style sheet "books_style.xsl" is included using the <?xml-stylesheet….?> tag.

The code in the "books_style.xsl" file could be something like,

<?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>Books List</h2>
<table border="1">
<tr bgcolor="#eeeeee">
<th align="left">Author</th>
<th align="left">Book Title</th>
</tr>
<xsl:for-each select="books/book">
<tr>
<td><xsl:value-of select="author"/></td>
<td><xsl:value-of select="title"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

After you create this .xsl file and that .xml file, you can try to view that xml file in the browser. Now you will not see the tree like structure as you would normally see the xml files. Check it out!

Altova Version 2010 Release 2 Delivers Significant Speed and Performance Enhancements Across Its MissionKit Product Line (Marketwire)
New 64-Bit Version Altova MissionKit Reduces Limitations Associated With Working With Large XML Files

Altova Version 2010 Release 2 Delivers Significant Speed and Performance Enhancements Across Its MissionKit Product Line (Marketwire via Yahoo! Finance)
BEVERLY, MA--(Marketwire - 02/16/10) - Altova ( http://www.altova.com ), creator of XMLSpy, the industry leading XML editor , today announced the availability of Version 2010 Release 2 (v2010r2) of the Altova MissionKit, an integrated suite of XML, database, and UML tools. Version 2010 Release 2 provides users with new, native 64-bit versions of all Altova MissionKit ...



FREE Subscription

Subscribe to our mailing list and receive new articles
through email. Keep yourself updated with latest
developments in the industry.

Name:
Email:

Note : We never rent, trade, or sell my email lists to
anyone. We assure that your privacy is respected
and protected.

_______________________________________

Recommended XML Books

cover
cover
cover
cover
cover
cover






 

 

FREE Subscription

Stay Current With the Latest Technology Developments Realted to XML. Signup for Our Newsletter and Receive New Articles Through Email.

Name:

Email:

Note : We never rent, trade, or sell our email lists to anyone. We assure that your privacy is respected and protected.

 

 

Add to My Yahoo!


New XML Books Titles - Best Seller's @ Amazon.com

Visit XML Training Material Guide Homepage

Technology helps engage students - how do classroom instruction and social dynamics change when the classroom is completely dependant on modern technology?

Cisco CCNA Certification Video Tutorial Guide - Learn How to Pass the Cisco CCNA 640-802 Exam... Guaranteed!

Train Signal Computer Training