Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


[xsl] XSL processor version detection stylesheet with XSLT 2.0 properties

From: Tony Graham <Tony.Graham@---------------------->
To:
Date: 10/1/2007 9:18:00 AM
The XSL processor detection stylesheet [1] referred to from the XSL-List
Guidelines predates XSLT 2.0 by several years, so it doesn't use the
additional system properties defined in XSLT 2.0 [2].  It also omits the
'xsl:version' system property, which at the time had only one possible
value.

The version below uses all the system properties defined in XSLT 2.0:

------------------------------------------------------------
<?xml version="1.0"?>
<?xml-stylesheet href="processor-version.xsl" type="text/xsl"?>
<!-- ============================================================= -->
<!-- MODULE:    XSL Processor Version Detection Stylesheet         -->
<!-- ============================================================= -->

<html xsl:version="1.0"
      xmlns:msxsl="http://www.w3.org/TR/WD-xsl"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns="http://www.w3.org/TR/xhtml1/strict">
  <head>
    <title>XSLT Processor Version</title>
  </head>
  <body>
    <xsl:choose>
      <xsl:when test="false()">
        <msxsl:if test=".">
          <p>Vendor: Microsoft
          <br/>Processor version:
            Original IE5 (or old version of other processor)</p>
        </msxsl:if>
      </xsl:when>
      <xsl:otherwise>
        <msxsl:choose>
          <msxsl:when test=".">
          </msxsl:when>
          <msxsl:otherwise>
            <p>XSL version:
	      <xsl:value-of select="system-property('xsl:version')"/></p>
            <p>Vendor:
	      <xsl:value-of select="system-property('xsl:vendor')"/></p>
            <p>Vendor URL:
              <xsl:value-of select="system-property('xsl:vendor-url')"/></p>
            <p>Product name:
              <xsl:value-of select="system-property('xsl:product-name')"/></p>
            <p>Product version:
              <xsl:value-of select="system-property('xsl:product-version')"/></p>
            <p>Is schema-aware:
              <xsl:value-of select="system-property('xsl:is-schema-aware')"/></p>
            <p>Supports serialization:
              <xsl:value-of select="system-property('xsl:supports-serialization')"/></p>
            <p>Supports backwards compatibility:
              <xsl:value-of select="system-property('xsl:supports-backwards-compatibility')"/></p>
          </msxsl:otherwise>
        </msxsl:choose>
      </xsl:otherwise>
    </xsl:choose>
  </body>
</html>
------------------------------------------------------------

Sample output from xsltproc:

------------------------------------------------------------
<?xml version="1.0"?>
<html xmlns:msxsl="http://www.w3.org/TR/WD-xsl" xmlns="http://www.w3.org/TR/xhtml1/strict"><head><title>XSLT Processor Version</title></head><body><msxsl:choose><msxsl:when test="."/><msxsl:otherwise><p>XSL version:
	      1.0</p><p>Vendor:
	      libxslt</p><p>Vendor URL:
              http://xmlsoft.org/XSLT/</p><p>Product name:
              </p><p>Product version:
              </p><p>Is schema-aware:
              </p><p>Supports serialization:
              </p><p>Supports backwards compatibility:
              </p></msxsl:otherwise></msxsl:choose></body></html>
------------------------------------------------------------

and from Saxon:

------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?><html xmlns="http://www.w3.org/TR/xhtml1/strict" xmlns:msxsl="http://www.w3.org/TR/WD-xsl"><head><title>XSLT Processor Version</title></head><body><msxsl:choose><msxsl:when test="."/><msxsl:otherwise><p>XSL version:
	      2.0</p><p>Vendor:
	      SAXON 8.9.0.4 from Saxonica</p><p>Vendor URL:
              http://www.saxonica.com/</p><p>Product name:
              SAXON</p><p>Product version:
              8.9.0.4</p><p>Is schema-aware:
              no</p><p>Supports serialization:
              yes</p><p>Supports backwards compatibility:
              yes</p></msxsl:otherwise></msxsl:choose></body></html>
------------------------------------------------------------

Regards,


Tony Graham.
======================================================================
Tony.Graham@xxxxxxxxxxxxxxxxxxxxxx   http://www.menteithconsulting.com

Menteith Consulting Ltd             Registered in Ireland - No. 428599
Registered Office: 13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
----------------------------------------------------------------------
Menteith Consulting -- Understanding how markup works
======================================================================

[1] http://www.mulberrytech.com/xsl/xsl-list/processor-version.xsl
[2] http://www.w3.org/TR/xslt20/#system-property


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent