Understanding stylesheets and XML

When we say style sheets for the xml file we are mentioning about the xsl files. The xsl files have data that are used for formatting the xml data and display them in other forms like html along with the styles. XSL is for XML and CSS is for the HTML.


_______________________________________________


You can include a style sheet file in the xml file itself. If you do this, the xml file will be displayed with the styles incorporated in it. If you want to include an xsl file in the xml file, then you can use the following syntax,

<?xml-stylesheet type="text/xsl" href="xsl_file.xsl"?>

The above code will include the xsl file for that xml and the data will be displayed according to the formatting instructions given in the xsl_file.xsl.

A style sheet file will have the root tag as <xsl:stylesheet> or <xsl:transform>. This tag will include the namespace of the XSLT. The version number is also included as an attribute. Hence the root element in the xsl file will look like,

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

By using the different elements of the xsl file like, xsl:template, xsl:for-each, and xsl:value-of, you can navigate through the elements and format the ways in which they have to be displayed.




_______________________________________________

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.

_______________________________________







 

 

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!

Visit XML Training Material Guide Homepage

 

 

Copyright - © 2004 - 2017 - All Rights Reserved.