Extension selection

1. Extension capability


Extension capability

Steve Muench and others.

what processor is using this stylesheet?

Is there something one can put on a test= to determine what
processor is running, e.g. in English,

   <xsl:when test="saxon is being used to process this stylesheet">
     <-- [do X] -->
     <!-- otherwise it is xt or xalan or etc. -->
     <!-- do Y -->

The XSLT 1.0 Spec is careful to provide the necessary
mechanisms to built robust, portable XSLT stylesheets, even
in the face of cool extensions.

The <xsl:fallback> and element-available('qname') and
function-available('qname') let you have good, proactive
control as to what should happen if an extension on which
you depend is not available.

Steve Tinney adds

You need to determine the xsl:vendor string using a test
file and then apply that in your real tests.  This could be
modularized so that one could say:

	<xsl:import href="vendors.xsl"/>
        <xsl:variable name="vendor">
          <xsl:call-template name="set-vendor"/>

and in vendors.xsl:

<xsl:template name="set-vendor">
  <xsl:variable name="xsl-vendor"
    <xsl:when test="starts-with($xsl-vendor,'SAXON')">
    <xsl:when test="contains($xsl-vendor,'Clark')">
      <xsl:text>UNKNOWN VENDOR</xsl:text>

Steve finishes with

Using the following stylesheet:

	    version="1.0" xsl:version="1.0">

 <xsl:template match="/">
xsl:version    = <xsl:value-of select="system-property('xsl:version')"/> 
xsl:vendor     = <xsl:value-of select="system-property('xsl:vendor')"/> 
xsl:vendor-url = <xsl:value-of select="system-property('xsl:vendor-url')"/> 

I get:

Apache Xalan 0.20.0
- -------------------
xsl:version    = 1
xsl:vendor     = Apache Software Foundation
xsl:vendor-url = http://xml.apache.org/xalan

Oracle XSLT Processor
- -----------------------------
xsl:version    = 1.0
xsl:vendor     = Oracle Corporation.
xsl:vendor-url = http://www.oracle.com

- --
xsl:version    = 1
xsl:vendor     = James Clark
xsl:vendor-url = http://www.jclark.com/

Saxon 5.2
- ---------
xsl:version    = 1
xsl:vendor     = SAXON from Michael Kay of ICL
xsl:vendor-url = http://users.iclway.co.uk/mhkay/saxon/index.html