IT Community - Software Programming, Web Development and Technical Support

What is XSLT? and what's its use?

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...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > XML and SOAP

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 07-25-2007, 06:40 AM
devarajan.v devarajan.v is offline
D-Web Master
 
Join Date: May 2007
Posts: 382
devarajan.v is on a distinguished road
Question What is XSLT? and what's its use?

Hi guys,

Can any one expalin what is XSLT? and what's its use?


Thanks & regards
devarajan.V
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-26-2007, 03:37 AM
vadivelanvaidyanathan vadivelanvaidyanathan is offline
D-Web Genius
 
Join Date: Feb 2007
Posts: 803
vadivelanvaidyanathan is on a distinguished road
Default Re: What is XSLT? and what's its use?

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.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-11-2007, 01:43 AM
Venkat Venkat is offline
D-Web Master
 
Join Date: Mar 2007
Posts: 350
Venkat is on a distinguished road
Thumbs up Re: What is XSLT? and what's its use?

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
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 09-18-2007, 11:39 PM
mobilegeek mobilegeek is offline
D-Web Analyst
 
Join Date: Jun 2007
Posts: 205
mobilegeek is on a distinguished road
Question Re: What is XSLT? and what's its use?

Hi all,

Can any body explain me how to use xslt in C#?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 09-19-2007, 12:17 AM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 1,061
S.Vinothkumar is on a distinguished road
Wink Re: What is XSLT? and what's its use?

Quote:
Originally Posted by mobilegeek View Post
Hi all,

Can any body explain me how to use xslt in C#?
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>) ;
2) Load the Xsl file
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) ;
Compile and run the application. Usage is as follows:
Code:
XmlTransformUtil.exe <xml file path> <xsl file path>
C# coding is as follows,
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!
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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


All times are GMT -7. The time now is 01:13 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0