This is a discussion on What is XSLT? and what's its use? within the XML and SOAP forums, part of the Web Development category; Hi guys, Can any one expalin what is XSLT? and what's its use? Thanks & regards devarajan.V...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| XSL Transformations (XSLT) is yet another popular W3C specification that defines XML-based syntax, used to transform XML documents to any other text format, such as HTML, text, XML, etc. XSLT stylesheets can be applied on the source XML document to transform XML into some other XML, or text, HTML, or any other text format. |
| |||
| hi, The World Wide Web Consortium (W3C) started to develop XSL because there was a need for an XML-based style sheet language. XSLT is a language for transforming XML documents into XHTML documents or to other XML documents. * XSLT stands for XSL Transformations * XSLT is the most important part of XSL * XSLT transforms an XML document into another XML document * XSLT uses XPath to navigate in XML documents * XSLT is a W3C Recommendation XSLT is the most important part of XSL. XSLT is used to transform an XML document into another XML document, or another type of document that is recognized by a browser, like HTML and XHTML. Normally XSLT does this by transforming each XML element into an (X)HTML element. With XSLT you can add/remove elements and attributes to or from the output file. You can also rearrange and sort elements, perform tests and make decisions about which elements to hide and display, and a lot more. A common way to describe the transformation process is to say that XSLT transforms an XML source-tree into an XML result-tree.
__________________ Venkat knowledge is Power |
| |||
| Yes I can geek! Xml is a meta-markup language that provides a format for describing data. Xslt is one way to consume and transform this data into a variety different formats, including Xml, html and wml. In this article we shall learn how to transform a simple Xml document using Xslt. The .NET framework provides rich support for the manipulation of Xml documents. Xml Transformation steps The steps to transform an Xml document are 1) Load the Xml document Code: XPathDocument myXPathDoc = new XPathDocument(<xml file path>) ; Code: XslTransform myXslTrans = new XslTransform() ; myXslTrans.Load(<xsl file path>); 3) Create a stream for output Code: XmlTextWriter myWriter = new XmlTextWriter("result.html",null) ; 4) Perform the actual transformation Code: myXslTrans.Transform(myXPathDoc,null,myWriter) ; Code: XmlTransformUtil.exe <xml file path> <xsl file path> Code: using System ;
using System.IO ;
using System.Xml ;
using System.Xml.Xsl ;
using System.Xml.XPath ;
public class XmlTransformUtil{
public static void Main(string[] args){
if (args.Length == 2){
Transform(args[0], args[1]) ;
}else{
PrintUsage() ;
}
}
public static void Transform(string sXmlPath, string sXslPath){
try{
//load the Xml doc
XPathDocument myXPathDoc = new XPathDocument(sXmlPath) ;
XslTransform myXslTrans = new XslTransform() ;
//load the Xsl
myXslTrans.Load(sXslPath) ;
//create the output stream
XmlTextWriter myWriter = new XmlTextWriter
("result.html", null);
//do the actual transform of Xml
myXslTrans.Transform(myXPathDoc,null, myWriter);
myWriter.Close() ;
}catch(Exception e){
Console.WriteLine("Exception: {0}", e.ToString());
}
}
public static void PrintUsage(){
Console.WriteLine
("Usage: XmlTransformUtil.exe <xml path> <xsl path>");
}
}
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| install xslt extension for php.? | JSureshkumar | PHP Programming | 0 | 01-16-2008 07:32 PM |
| What is the benefits of applying XSLT? | devarajan.v | XML and SOAP | 1 | 07-27-2007 08:29 AM |