<html>
<head>
<title>system-property() Function</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div id="Description">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="NAME">system-property() Function</td>
<td valign="top" class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td valign="top" colspan="2" class="description">
Returns the value of the system property named by the argument to the function.</td></tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Description</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>
  By definition, all XSLT processors must support three system properties:
</p>
<dl>
<dt>
<span class="LITERAL">
xsl:version
</span>
</dt>
<dd>
A floating-point number representing the version of XSLT implemented by this XSLT processor. As of this writing, the only official version of XSLT supported by any XSLT processors is
<span class="LITERAL">
1.0
</span>
.
<P></p>
<dt>
<span class="LITERAL">
xsl:vendor
</span>
</dt>
<dd>
A string that identifies the vendor of this XSLT processor.
<P></p>
<dt>
<span class="LITERAL">
xsl:vendor-url
</span>
</dt>
<dd>
A string containing the URL identifying the vendor of the XSLT processor. This string is typically the home page of the vendor's web site.
<P></p>
</dl>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Inputs</td>
</tr>
<tr>
<td colspan="2" class="description">
<!--<?troff .hw vendor?>-->
<p>  
The XSLT 1.0 specification defines three properties: <span class="LITERAL">xsl:version</span>, <span class="LITERAL">xsl:vendor</span>, and <span class="LITERAL">xsl:vendor-url</span>. 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.</p>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Output</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>The value of the queried property. </p>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Defined in</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>XSLT section 12.4, Miscellaneous Additional Functions. </p>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>Here is a stylesheet that queries different properties of the XSLT processor:</p>
<span class="PROGRAMLISTING"><pre>
&lt;?xml version="1.0"?&gt;
&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
  
  &lt;xsl:output method="text"/&gt;

  &lt;xsl:variable name="newline"&gt;
&lt;xsl:text&gt;
&lt;/xsl:text&gt;
  &lt;/xsl:variable&gt;

  &lt;xsl:template match="/"&gt;
    &lt;xsl:text&gt;xsl:version = "&lt;/xsl:text&gt;
    &lt;xsl:value-of select="system-property('xsl:version')"/&gt;
    &lt;xsl:text&gt;"&lt;/xsl:text&gt;&lt;xsl:value-of select="$newline"/&gt;
    &lt;xsl:text&gt;xsl:vendor = "&lt;/xsl:text&gt;
    &lt;xsl:value-of select="system-property('xsl:vendor')"/&gt;
    &lt;xsl:text&gt;"&lt;/xsl:text&gt;&lt;xsl:value-of select="$newline"/&gt;
    &lt;xsl:text&gt;xsl:vendor-url = "&lt;/xsl:text&gt;
<!--<?troff .Nd 10?>-->
    &lt;xsl:value-of select="system-property('xsl:vendor-url')"/&gt;
    &lt;xsl:text&gt;"&lt;/xsl:text&gt;&lt;xsl:value-of select="$newline"/&gt;
  &lt;/xsl:template&gt;

&lt;/xsl:stylesheet&gt;</pre></span>

<p>When the stylesheet is applied toward any XML document with the Xalan XSLT processor (invoked by the following command):</p>

<span class="PROGRAMLISTING"><pre>
java org.apache.xalan.xslt.Process -in test1.xml -xsl systemproperties.xsl</pre></span>

<p>The results are:</p>
<span class="PROGRAMLISTING"><pre>
xsl:version = "1"
xsl:vendor = "Apache Software Foundation"
xsl:vendor-url = "http://xml.apache.org/xalan"
</pre></span>

<p>The following command invokes the results for Michael Kay's Saxon processor:</p>

<span class="PROGRAMLISTING"><pre>
java com.icl.saxon.StyleSheet test1.xml systemproperties.xsl</pre></span>

<p>Here are the results:</p>

<span class="PROGRAMLISTING"><pre>
xsl:version = "1"                                                      
xsl:vendor = "SAXON 6.4.3 from Michael Kay"                     
xsl:vendor-url = "http://saxon.sourceforge.net"</pre></span>

<p>We invoked Oracle's XML parser with:</p>

<span class="PROGRAMLISTING"><pre>
java oracle.xml.parser.v2.oraxsl test1.xml systemproperties.xsl</pre></span>

<p>Here are the results:</p>
<span class="PROGRAMLISTING"><pre>
xsl:version = "1"
xsl:vendor = "Oracle Corporation."
xsl:vendor-url = "http://www.oracle.com"</pre></span>
<p>We invoked James Clark's XT processor with:</p> 

<span class="PROGRAMLISTING"><pre>
java com.jclark.xsl.sax.Driver test1.xml systemproperties.xsl</pre></span>

<p>Here are the results:</p>
<span class="PROGRAMLISTING"><pre>
xsl:version = "1"
xsl:vendor = "James Clark"
xsl:vendor-url = "http://www.jclark.com/"
</pre></span>
<p>Finally, we invoked Microsoft's XSLT processor with:</p>

<span class="PROGRAMLISTING"><pre>msxsl test1.xml systemproperties.xsl</pre></span>
<!--<?troff .Nd 10?>-->
<p>Here are the results:</p>
<span class="PROGRAMLISTING"><pre>
xsl:version = "1"
xsl:vendor = "Microsoft"
xsl:vendor-url = "http://www.microsoft.com"</pre></span>

</td>
</tr>
</table>
</div>
</body>
</html>