Environment Variable Retrieval Spec

"John L. Clark" <[email protected]>
Newsgroups gmane.text.xml.xslt.extensions
Message-ID <20060216075751.GS10347@rejoice>
Let's get the specs rolling again, shall we?

I've taken a shot at a simple spec for the namespace that will allow
conforming implementations to retrieve environment variables using the
`system-property` function, based upon Colin Paul Adams' original
request[0] and the subsequent discussion.

Note that the argument to the system-property function must be a string,
and not a "direct" QName.

As this is neither an extension function nor an extension element, I
included the specification of this mechanism directly in the body of the
module's description.  This is also the introduction of the 'System'
module, which currently only contains this namespace specification.

I've included both the spec's source XML and the formatted user HTML
page, for your review.

Take care,

    John L. Clark

[0] http://lists.fourthought.com/pipermail/exslt/2004-December/001129.html

_______________________________________________
exslt mailing list
[email protected]
http://www.exslt.org/list
sys.xml (text/plain, 2.7 KB)
<?xml version="1.0"?>

<?xml-stylesheet type="text/xsl" href="../style/module.stylesheet.xsl" ?>

<exslt:module xmlns:exslt="http://exslt.org/documentation"

              version="1" prefix="sys">



<exslt:name>System</exslt:name>



<rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"

                 xmlns:dc="http://purl.org/dc/elements/1.1/"

                 ID="sys">

  <dc:subject>EXSLT</dc:subject>

  <dc:subject>system</dc:subject>

  <dc:subject>module</dc:subject>

  <exslt:revision>

    <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"

                     xmlns:dc="http://purl.org/dc/elements/1.1/"

                     ID="sys.1">

      <exslt:version>1</exslt:version>

      <dc:creator>John L. Clark</dc:creator>

      <dc:date>2006-02-15</dc:date>

      <dc:description>Specify a namespace for access to environment variables.</dc:description>

    </rdf:Description>

  </exslt:revision>

</rdf:Description>



<exslt:doc xmlns="http://www.w3.org/1999/xhtml">

  <div>

    <p><em>EXSLT - System</em> provides features for using the host

    system.</p>



    <p>In addition to any stylesheet components, this module specifies a

    namespace-<code>http://exsl.org/environment</code>-for accessing

    environment variables using the <a

    href="http://www.w3.org/TR/xslt.html#function-system-property"><code>system-property</code></a>

    function.</p>



    <p>Use this namespace as follows.  Given <code>SQ</code>, a string that

    is a <a href="http://www.w3.org/TR/REC-xml-names#NT-QName">QName</a>

    with a prefix that maps to <code>http://exsl.org/environment</code> and

    local part <code>L</code>, <code>system-property(SQ)</code> returns the

    value of the system environment variable <code>L</code>.  For example,

    if "<code>env</code>" maps to this namespace, then

    <code>system-property("env:USER")</code> might return "john".</p>



    <p>The result of a call to system-function ("env:X") MUST always return

    the same value (for a given X) throughout the processing session.  Which

    environment variables are available to a given XSLT transformation is

    system- and implementation-dependent.  Whenever an implementation cannot

    provide a value for a given environment variable, it MUST return the

    zero-length string as the result of the <code>system-property</code>

    call.  The mapping of the encoding of the variable's original value to

    that of the XPath string object is implementation-dependent.</p>



    <p><strong>Note:</strong> Retrieving environment variables can pose a

    security risk if those environment variables expose sensitive system

    information.</p>

  </div>

</exslt:doc>



</exslt:module>
index.html (text/html, 4.8 KB)
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "/schema/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /><title>EXSLT - System</title><link rel="stylesheet" href="http://exslt.org/base.css" /></head><body><h1 id="#title"><a href="http://www.exslt.org/">EXSLT</a> - <a href="http://www.exslt.org/sys/">System</a></h1><table><tr><td id="menu"><p class="level1"><a href="sys.html">Implementer Page</a></p><p class="level1"><a href="../howto.html">How To</a></p><p class="level1"><a href="../download.html">Downloads</a></p><p class="level1">Modules</p><p class="level2"><a href="../date/index.html">Dates and Times</a></p><p class="level2"><a href="../dyn/index.html">Dynamic</a></p><p class="level2"><a href="../exsl/index.html">Common</a></p><p class="level2"><a href="../func/index.html">Functions</a></p><p class="level2"><a href="../math/index.html">Math</a></p><p class="level2"><a href="../random/index.html">Random</a></p><p class="level2"><a href="../regexp/index.html">Regular Expressions</a></p><p class="level2"><a href="../set/index.html">Sets</a></p><p class="level2"><a href="../str/index.html">Strings</a></p><p class="level2"><a href="../sys/index.html">System</a></p><p class="level1"><a href="../submissions/">Submissions</a></p><p class="level1"><a href="../list">Mailing List</a></p><p class="level1"><a href="../contact.html">Contact</a></p></td><td id="content"><p><b>Implementer Page: </b><a href="sys.html">sys.html</a><br /><b><a href="../howto.html#module-level">Module Package</a>: </b><a href="sys.zip">sys.zip</a></p><div><p><em>EXSLT - System</em> provides features for using the host
    system.</p><p>In addition to any stylesheet components, this module specifies a
    namespace-<code>http://exsl.org/environment</code>-for accessing
    environment variables using the <a href="http://www.w3.org/TR/xslt.html#function-system-property"><code>system-property</code></a>
    function.</p><p>Use this namespace as follows.  Given <code>SQ</code>, a string that
    is a <a href="http://www.w3.org/TR/REC-xml-names#NT-QName">QName</a>
    with a prefix that maps to <code>http://exsl.org/environment</code> and
    local part <code>L</code>, <code>system-property(SQ)</code> returns the
    value of the system environment variable <code>L</code>.  For example,
    if "<code>env</code>" maps to this namespace, then
    <code>system-property("env:USER")</code> might return "john".</p><p>The result of a call to system-function ("env:X") MUST always return
    the same value (for a given X) throughout the processing session.  Which
    environment variables are available to a given XSLT transformation is
    system- and implementation-dependent.  Whenever an implementation cannot
    provide a value for a given environment variable, it MUST return the
    zero-length string as the result of the <code>system-property</code>
    call.  The mapping of the encoding of the variable's original value to
    that of the XPath string object is implementation-dependent.</p><p><strong>Note:</strong> Retrieving environment variables can pose a
    security risk if those environment variables expose sensitive system
    information.</p></div><p>
      XSLT processors may support any number of the extension elements and functions given in this module.
   </p><p class="note">
      Using EXSLT will only make your stylesheet portable amongst the implementations that support EXSLT. Note that there is no requirement for XSLT processors that are compliant to XSLT to support the extensions described within EXSLT.
   </p><h2>Namespace</h2><p>
      The namespace for EXSLT - System is:
   </p><pre>http://exslt.org/system</pre><p>
      Throughout this document, the prefix <code>sys</code> is used to refer to this namespace. Any other prefix can be used within a particular stylesheet (though a prefix must be specified to enable the extension functions to be recognised as extensions).
   </p><p>
      To use these extensions, you need to declare this namespace as an extension namespace in your stylesheet.  If your processor supports this module, then that's all you need to do, but if it doesn't, then you need to use a specific third-party implementation or the module stylesheet.  Typically, your stylesheet will look like:
   </p><pre>
&lt;xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:sys="http://exslt.org/system"
                extension-element-prefixes="sys"&gt;

&lt;xsl:import href="sys.xsl" /&gt;

...
              
&lt;/xsl:stylesheet&gt;
</pre></td></tr></table><div id="colophon"><p><a href="http://www.exslt.org/sys/index.html">http://www.exslt.org/sys/index.html</a> last modified 2006-02-15</p></div></body></html>
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.7 (GNU/Linux)

iD8DBQFD9DB+jkcskvOyl78RArP2AJ4xP1TITbyyPsO3RJ6hcRT9gncwnwCcCq/a
1A/45ePJK16fUSQfEr3RwQI=
=Lf1B
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.