Implement XSL Transformation on XML Document

Posted by Lakhangarg under Others category on | Views : 1892
XSLT (Extensible StyleSheet Language Transformations)
XSL stands for Extensible StyleSheet Language, and is a style sheet language for XML documents. XSLT stands for XSL Transformations. XSL = Style Sheets for XML.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

XSLT is a language for transforming XML documents into XHTML documents or to other XML documents. XPath is a language for navigating in XML documents.

Implement Style on xml data:

*********************** Sample: Sample1.xml ************************
<?xml version="1.0" encoding="ISO-8859-1" ?>
<?xml-stylesheet type="text/xsl" href="Sample1.xslt"?>
<FirstName>Lakhan Pal Garg</FirstName>
********************* XSLT Sample: Sample1.xslt ************************
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="">
<xsl:template match="/">
<b>Author: </b><xsl:value-of select="SqlData/Table/FirstName" /><br/>
<b>Email ID:</b><xsl:value-of select="SqlData/Table/UserName" /><br/>
<b>Blog:</b><xsl:value-of select="SqlData/Table/Blog" />


Code to implement stylesheet on xml document:

XmlDocument docXML = new XmlDocument();
XslTransform docXSL = new XslTransform();
Xml1.Document = docXML;
Xml1.Transform = docXSL;

Author: Lakhan Pal Garg

Comments or Responses

Login to post response