| system-property() Function | |
| Returns the value of the system property named by the argument to the function. | |
| Description | |
|
By definition, all XSLT processors must support three system properties:
|
|
| Inputs | |
|
The XSLT 1.0 specification defines three properties: xsl:version, xsl:vendor, and xsl:vendor-url. These properties must be supported by all XSLT processors. Other properties may be supported by individual processors; check your processor's documentation for more information. |
|
| Output | |
|
The value of the queried property. |
|
| Defined in | |
|
XSLT section 12.4, Miscellaneous Additional Functions. |
|
| Example | |
|
Here is a stylesheet that queries different properties of the XSLT processor:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:variable name="newline">
<xsl:text>
</xsl:text>
</xsl:variable>
<xsl:template match="/">
<xsl:text>xsl:version = "</xsl:text>
<xsl:value-of select="system-property('xsl:version')"/>
<xsl:text>"</xsl:text><xsl:value-of select="$newline"/>
<xsl:text>xsl:vendor = "</xsl:text>
<xsl:value-of select="system-property('xsl:vendor')"/>
<xsl:text>"</xsl:text><xsl:value-of select="$newline"/>
<xsl:text>xsl:vendor-url = "</xsl:text>
<xsl:value-of select="system-property('xsl:vendor-url')"/>
<xsl:text>"</xsl:text><xsl:value-of select="$newline"/>
</xsl:template>
</xsl:stylesheet>
When the stylesheet is applied toward any XML document with the Xalan XSLT processor (invoked by the following command): java org.apache.xalan.xslt.Process -in test1.xml -xsl systemproperties.xsl The results are: xsl:version = "1" xsl:vendor = "Apache Software Foundation" xsl:vendor-url = "http://xml.apache.org/xalan" The following command invokes the results for Michael Kay's Saxon processor: java com.icl.saxon.StyleSheet test1.xml systemproperties.xsl Here are the results: xsl:version = "1" xsl:vendor = "SAXON 6.4.3 from Michael Kay" xsl:vendor-url = "http://saxon.sourceforge.net" We invoked Oracle's XML parser with: java oracle.xml.parser.v2.oraxsl test1.xml systemproperties.xsl Here are the results: xsl:version = "1" xsl:vendor = "Oracle Corporation." xsl:vendor-url = "http://www.oracle.com" We invoked James Clark's XT processor with: java com.jclark.xsl.sax.Driver test1.xml systemproperties.xsl Here are the results: xsl:version = "1" xsl:vendor = "James Clark" xsl:vendor-url = "http://www.jclark.com/" Finally, we invoked Microsoft's XSLT processor with: msxsl test1.xml systemproperties.xsl Here are the results: xsl:version = "1" xsl:vendor = "Microsoft" xsl:vendor-url = "http://www.microsoft.com" |
|