EXSLT.NET is a community-developed implementation of the EXSLT extensions to the XSLT 1.0 for the .NET platform. EXSLT.NET fully implements the following EXSLT modules: Dates and Times, Common, Math, Random, Regular Expressions, Sets and Strings. In addition EXSLT.NET provides a proprietary set of useful extension functions. See full list of supported extension functions and elements in "Extension Functions and Elements" section. For more info about EXSLT and EXSLT.NET see References.
Version 2.0 is the first EXSLT.NET release for the .NET 2.0 Framework. What's new in this version:
Typically you are using EXSLT.NET module in your application
via
Mvp.Xml.Common.Xsl.MvpXslTransform
class, which encapsulates EXSLT implementation:
using System;
using System.Xml.XPath;
using Mvp.Xml.Common.Xsl;
public class ExsltTest
{
public static void Main()
{
MvpXslTransform xslt = new MvpXslTransform();
xslt.Load("foo.xsl");
xslt.Transform(new XmlInput("foo.xml"), new XmlOutput("result.html"));
}
}
Additionally
MvpXslTransform
class has two properties -
SupportedFunctions and
MultiOutput, which allow you to control
which features should be supported, for instance you can
define that you need all extension function modules, but not multiple
output support (the default settings) by setting SupportedFunctions and MultipleOutput properies in your code before
the call to the Transform() method:
xslt.SupportedFunctions = ExsltFunctionNamespace.All;
xslt.MultiOutput = false;
Note: You can find more information about practical usage of the EXSLT.NET in the "Building Practical Solutions with EXSLT.NET" article at MSDN XML Developer Center.
It's also possible to use EXSLT.NET in XPath-only environment. For
doing that one makes use of Mvp.Xml.Exslt.ExsltContext
class:
XPathExpression expr = nav.Compile("set:distinct(//author)");
expr.SetContext(new ExsltContext(doc.NameTable));
XPathNodeIterator authors = nav.Select(expr);
while (authors.MoveNext())
Console.WriteLine(authors.Current.Value);
See "EXSLT Meets XPath" article for more information.
You can find full list of extension functions EXSLT.NET supports in doc\Functions.xml document. Here is HTML version.
Note: For compatibility, some extension functions (such as date:date-time()) have camelCased alias names, e.g. date:dateTime(). Both forms are equivalent names, referring to the same function implementation, although beware that alias names are non-standard ones, so most likely they won't be recognized by other EXSLT implementations.
The only extension element supported is exsl:document element. See "Multiple Output" section for more info.
EXSLT.NET partially supports exsl:document extension element. Not all exsl:document attributes and their values are supported in this version of the EXSLT.NET. The supported subset of attributes and values is as follows:
<exsl:document
href = { uri-reference }
method = { "xml" | "text" }
encoding = { string }
omit-xml-declaration = { "yes" | "no" }
standalone = { "yes" | "no" }
doctype-public = { string }
doctype-system = { string }
indent = { "yes" | "no" } >
<-- Content: template -->
</exsl:document>
exsl:document extension element is not supported when transformation is done to XmlReader or XmlWriter. In the latter case use overloaded Transform() method, which accepts instance of MultiXmlTextWriter class to transform to.
exsl:document extension element is
supported through postprocessing of transformation result using
customized XmlTextWriter class. This
unconditionally assumes the transformation is always done in XML, so
actually currently there is no way to produce real HTML (not XHTML)
result documents. More specifically, main result document is always
XML, but subsidiary result documents may be written either as XML or as
text, depending on the method attribute value of the
appropriate exsl:document
element.
Moreover, the xsl:output
element is
ignored. That only affects outputting of the main result document
though, because the xsl:output
element does
not affect outputting of any subsidiary result documents. It's
completely controlled by the exsl:document
element. Instead, you can get some control over outputting of the main
result document using the MultiXmlTextWriter
properties inherited from the XmlTextWriter
class, particularly with
encoding and
indentation.
The disabling of output escaping feature is ignored as always when XSL transformation is performed to an XmlWriter.
For more info about how it's implemented see "Producing Multiple Outputs from an XSL Transformation" article.
You can get support on using XInclude.NET module using the following options:
The project is hosted at
SourceForge. Find more at the Mvp.Xml project page at
SourceForge.
$Id: index.html,v 1.5 2005/11/27 21:23:46 helgy Exp $