Going Beyond the Basics

 
xslt for dummies
Chapter 16 - Extending XSLT
XSLT For Dummies
by Richard Wagner
Hungry Minds 2002
  

Extensions are modules that the XSLT processor implements and that support additional functionality. They can surface in XSLT as an element, attribute, or function, such as in the following code snippet:

 <xsl:template match="coffees" grd:guard="true"> <grd:guardian select="@bean"> <xsl:apply-templates select="grd:guardnodes(coffee)"/> </xsl:template> 

The grd:guard="true" gives an example of what an extension attribute might look like, the grd:guardian element demonstrates an extension element, and grd:guardnodes() represents an extension function.

 Remember   If an XSLT processor doesnt understand the extension, you cannot use it during your transformations.

By their very nature, extensions give you functionality that is outside standard XSLT, meaning their support is closely tied to the XSLT processor you use. In most cases, extensions are proprietary to a given processor and are useless when you attempt to transform the stylesheet with another vendors processing engine. However, a new community-led effort called EXSLT (Extensions for XSLT) seeks to provide a common set of XSLT extensions that can be supported across multiple XSLT processors. The obvious advantage in using EXSLT extensions is that, if EXSLT catches on, youll be able to use them on any processing engine that implements EXSLT support. SAXON is perhaps the best example of an XSLT processor that has started adding support for EXSLT functions. For the latest information on EXSLT extensions, go to the community-supported Web site ( www.exslt.org ).

 Tip   When you are evaluating XSLT processors, take a close look at the extensions that are provided. Even if you dont need extensions now, extension support may be important for you in the future as your needs grow.

 Tip   Microsofts approach to extensions with msxsl is slightly different than the other XSLT processor vendors . Rather than supporting a rich library of extension elements and functions, msxsl has a single extension element called msxsl:script that serves as their gateway for adding scripting (JavaScript or VBScript) into your stylesheets. In effect, this feature of msxsl enables you to write your own extensions by using a script.

  
 
 
2000-2002    Feedback


XSLT For Dummies
XSLT for Dummies
ISBN: 0764536516
EAN: 2147483647
Year: 2002
Pages: 148

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net