Subject: [xsl] Re: opinions on ease of use with EXSLT for .NET From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx> Date: Thu, 18 Dec 2003 08:34:49 +0100 |
<kakridge@xxxxxxxxxxxxx> wrote in message news:001701c3c521$54a5cad0$02fea8c0@xxxxxxxxx > How difficult is it to use EXSLT for .NET. Right now, I have a lot of > code in place already for handling translations. This isn't like the > non-.NET EXSLT where you can just import a template/function? You do not understand what EXSLT really is. Its idea is to be implemented by the vendors of XSLT processors (as it is done in the majority of cases -- e.g. Saxon, Xalan, JD, xsltProc, etc...) or by third parties, so that the XSLT programmer only has to declare the necessary EXSLT namespace and use the EXSLT functions in XPath expressions. Recently EXSLT has been implemented for .Net xsltTransform and partially (the Common and Sets modules) for MSXML4. No importing of templates is necessary and in fact nothing should be imported. The xslt stylesheets provided at the EXSLT site are to be used only with XSLT processors, for which there is no other known implementation. Often these stylesheets do not implement all functions or implement them with limited capabilities. > Do I have > to rebuild some of the classes that handle my transformations? You just install EXSLT.Net.Read the MSDN articles on EXSLT: "EXSLT: Enhancing the Power of XSLT" at: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnexxml/html/xml05192003.asp and "EXSLT Meets XPath" at: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnexxml/html/xml11172003.asp To use EXSLT.Net one typically writes the following code (which is almost identical to the code when EXSLT is not used). This code snippet is copied from the first article above: using System.IO; using System.Xml.XPath; using System.Xml.Xsl; using System.Xml; using Exslt; using System; public class Test{ private const String filename = "test.xml"; private const String stylesheet = "test.xsl"; public static void Main(string[] args){ try{ //Create the XslTransform and load the stylesheet. ExsltTransform exslt = new ExsltTransform(); exslt.Load(stylesheet); //Load the XML data file. XPathDocument doc = new XPathDocument(filename); //Create an XsltArgumentList. XsltArgumentList xslArg = new XsltArgumentList(); //Create an XmlTextWriter to output to the console. XmlTextWriter writer = new XmlTextWriter(Console.Out); //Transform the file. exslt.Transform(doc, xslArg, writer); writer.Close(); }catch(Exception e){ Console.WriteLine("UNEXPECTED ERROR: " + e.ToString()); } } } While just testing the transformation one may use tools like XSelerator or XML SPY and integrate the Nxslt.exe commad-line utility -- then running .Net xsltTransform is just a one-click job. Hope this helped. Dimitre Novatchev, FXSL developer http://fxsl.sourceforge.net/ -- the home of FXSL Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] opinions on ease of use with , kakridge | Thread | RE: [xsl] Re: opinions on ease of u, kakridge |
[xsl] Re: pretty-printing XML into , Dimitre Novatchev | Date | RE: [xsl] Literal result element na, Jones, Rick |
Month |