C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




xslt


Posted Date: 21 Jul 2008      Total Responses: 2

Posted By: kumar       Member Level: Bronze     Points: 1



hi friends can u please give me some simple examples for creating xslt

thanx





Responses

Author: Shivshanker Cheral    21 Jul 2008Member Level: DiamondRating:     Points: 0

XSL stands for EXtensible Stylesheet Language.

The World Wide Web Consortium (W3C) started to develop XSL because there was a need for an XML-based style sheet language.

XSLT stands for XSL Transformations. In this tutorial you will learn how to use XSLT to transform XML documents into other formats, like XHTML.


It started with XSL and ended up with XSLT, XPath, and XSL-FO.


--------------------------------------------------------------------------------

It Started with XSL
XSL stands for EXtensible Stylesheet Language.

The World Wide Web Consortium (W3C) started to develop XSL because there was a need for an XML-based Stylesheet Language.


--------------------------------------------------------------------------------

CSS = HTML Style Sheets
HTML uses predefined tags and the meaning of the tags are well understood.

The <table> element in HTML defines a table - and a browser knows how to display it.

Adding styles to HTML elements is simple. Telling a browser to display an element in a special font or color, is easy with CSS.


--------------------------------------------------------------------------------

XSL = XML Style Sheets
XML does not use predefined tags (we can use any tag-names we like), and the meaning of these tags are not well understood.

A <table> element could mean an HTML table, a piece of furniture, or something else - and a browser does not know how to display it.

XSL describes how the XML document should be displayed!


--------------------------------------------------------------------------------

XSL - More Than a Style Sheet Language
XSL consists of three parts:

XSLT - a language for transforming XML documents
XPath - a language for navigating in XML documents
XSL-FO - a language for formatting XML documents

refer

http://www.w3schools.com/xsl/xsl_languages.asp
http://www.w3.org/TR/xslt



Author: Ramya    03 Sep 2008Member Level: GoldRating:     Points: 6

This is an example from w3Schools

XML File
<?xml version="1.0" encoding="ISO-8859-1" ?>
- <!-- Edited by XMLSpy®
-->
- <breakfast_menu>
- <food>
<name>Belgian Waffles</name>
<price>$5.95</price>
<description>two of our famous Belgian Waffles with plenty of real maple syrup</description>
<calories>650</calories>
</food>
- <food>
<name>Strawberry Belgian Waffles</name>
<price>$7.95</price>
<description>light Belgian waffles covered with strawberries and whipped cream</description>
<calories>900</calories>
</food>
- <food>
<name>Berry-Berry Belgian Waffles</name>
<price>$8.95</price>
<description>light Belgian waffles covered with an assortment of fresh berries and whipped cream</description>
<calories>900</calories>
</food>
- <food>
<name>French Toast</name>
<price>$4.50</price>
<description>thick slices made from our homemade sourdough bread</description>
<calories>600</calories>
</food>
- <food>
<name>Homestyle Breakfast</name>
<price>$6.95</price>
<description>two eggs, bacon or sausage, toast, and our ever-popular hash browns</description>
<calories>950</calories>
</food>
</breakfast_menu>


XSLT
<?xml version="1.0" encoding="ISO-8859-1" ?>
- <!-- Edited by XMLSpy®
-->
- <html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
- <body style="font-family:Arial;font-size:12pt;background-color:#EEEEEE">
- <xsl:for-each select="breakfast_menu/food">
- <div style="background-color:teal;color:white;padding:4px">
- <span style="font-weight:bold">
<xsl:value-of select="name" />
</span>
-
<xsl:value-of select="price" />
</div>
- <div style="margin-left:20px;margin-bottom:1em;font-size:10pt">
<xsl:value-of select="description" />
- <span style="font-style:italic">
(
<xsl:value-of select="calories" />
calories per serving)
</span>
</div>
</xsl:for-each>
</body>
</html>


see the result file attached.



Post Reply
You must Sign In to post a response.
Next : Loading 10 MB XML - Performance Issue
Previous : What is XSD in xml
Return to Discussion Forum
Post New Message
Category: XML

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use