Which version of XPATH and XSLT am I using..?

20,359

Solution 1

In XSLT, call system-property('xsl:version'). It will return 1.0 or 2.0 depending on whether you are using a 1.0 or 2.0 processor.

In XPath, there's no direct equivalent. But a quick test is to call current-date() with no arguments. If this succeeds, you have a 2.0 processor, if it fails, you have a 1.0 processor.

Unless you take steps to install a 2.0 processor such as Saxon on your class path or in the endorsed library, the XSLT processor that the JDK gives you will (today) be a 1.0 processor.

Solution 2

Well if you use Java then you have a choice of XSLT and XPath processors. The one built-in in the JDK (I only know of 1.6 but I don't think it has changed in 1.7) is Apache Xalan which is an XSLT and XPath 1.0 processor. There however third party solutions like Saxon 9 which support XSLT and XPath 2.0. And there are certainly additional XQuery 1.0 implementations for Java, as XPath 2.0 is a subset of XQuery 1.0, you have further choices if you are interested in XPath 2.0.

Solution 3

Try

java com.sun.org.apache.xalan.internal.xslt.EnvironmentCheck

For example for me this prints

#---- BEGIN writeEnvironmentReport($Revision: 1.10 $): Useful stuff found: ----
java.version=1.7.0_11
version.xalan2x=not-present
version.JAXP=1.4
java.ext.dirs=/usr/lib/jvm/java-7-oracle/jre/lib/ext:/usr/java/packages/lib/ext
version.SAX=2.0
version.crimson=not-present
java.class.path=.
version.ant=not-present
sun.boot.class.path=/usr/lib/jvm/java-7-oracle/jre/lib/resources.jar:/usr/lib/jvm/java-7-oracle/jre/lib/rt.jar:/usr/lib/jvm/java-7-oracle/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jsse.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jce.jar:/usr/lib/jvm/java-7-oracle/jre/lib/charsets.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jfr.jar:/usr/lib/jvm/java-7-oracle/jre/classes
version.DOM=3.0
version.xalan1=not-present
version.xalan2_2=Xalan Java 2.7.0
version.xerces2=Xerces-J 2.7.1
version.xerces1=not-present
#----- END writeEnvironmentReport: Useful properties found: -----
# YAHOO! Your environment seems to be OK.

Solution 4

  <xsl:comment>
    XSLT Version = <xsl:copy-of select="system-property('xsl:version')"/>
    XSLT Vendor = <xsl:copy-of select="system-property('xsl:vendor')"/>
    XSLT Vendor URL = <xsl:copy-of select="system-property('xsl:vendor-url')"/>
  </xsl:comment>
Share:
20,359
John
Author by

John

My name is John Best, from India. I have worked with VB 6.0 and Dot Net, Java, Eclipse, Oracle, SQL Server, mySQL, VBA. I had coding experience in Publications, Banking, Stock Market and Astrology (Financial Astrology) domains. Right now, I am working on a Financial Astrology software, which can be used to find the trend reversals. Various planetary cycles, both geocentric and heliocentric are used. Now I am over to finding suitable stocks on a particular trading day. This will be derived based on various astrological combinations which had occurred earlier.

Updated on October 04, 2020

Comments

  • John
    John almost 4 years

    How to know which version of XPATH and XSLT am I using...?

    Say I have installed JDK 1.7 then which version of XPATH and XSLT do I have..?