dleslie 00/10/17 13:45:34
Modified: java/xdocs/sources/xalan extensionslib.xml Log: Added nodeset example and some preliminary info on use of the new http://xml.apache.org/xalan namespace. Revision Changes Path 1.4 +58 -27 xml-xalan/java/xdocs/sources/xalan/extensionslib.xml Index: extensionslib.xml =================================================================== RCS file: /home/cvs/xml-xalan/java/xdocs/sources/xalan/extensionslib.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- extensionslib.xml 2000/10/16 21:56:58 1.3 +++ extensionslib.xml 2000/10/17 20:45:34 1.4 @@ -59,13 +59,14 @@ <s1 title="Extensions library"> <ul> <li><link anchor="intro">Introduction</link></li> +<li><link anchor="xalanns">Xalan namespace</link></li> <li><link anchor="redirect">Redirect</link></li> -<li><link anchor="nodeset">nodeset</link> <ref>(to be ported from Xalan-J 1)</ref></li> -<li><link anchor="sql">SQL extensions</link></li> +<li><link anchor="nodeset">nodeset</link></li> <li><link anchor="intersection">intersection</link></li> <li><link anchor="difference">difference</link></li> <li><link anchor="distinct">distinct</link></li> <li><link anchor="hassamenodes">hasSameNodes</link></li> +<li><link anchor="sql">SQL extensions</link></li> <li><link anchor="evaluate">evaluate</link> <ref>(to be done)</ref></li> <li><link anchor="groupitem">group and item</link> <ref>(to be done)</ref></li> <li><link anchor="type">type</link> <ref>(to be done)</ref></li> @@ -73,16 +74,21 @@ <li><link anchor="formatdate">formatDate</link> <ref>(to be done)</ref></li> <li><link anchor="grep">grep</link> <ref>(to be done)</ref></li> <li><link anchor="foreachtoken">forEachToken</link> <ref>(to be done)</ref></li> -<li>Examples: <link anchor="ex-redirect">Redirect</link>, <link anchor="ex-sql">SQL library</link></li> +<li>Examples: <link anchor="ex-redirect">Redirect</link>, <link anchor="ex-nodeset">nodeset</link>, <link anchor="ex-sql">SQL library</link></li> </ul><anchor name="intro"/> <s2 title= "Introduction"> <p>Extension elements and functions provide a powerful mechanism for extending and simplifying what you can do with an XLST processor like Xalan. With input and contributions from the XML open-source developer community, we are working on placing the most useful extensions in an extensions library distributed with &xslt4j;. If you have ideas and/or contributions you would like to make, please email us at <human-resource-ref idref="xalandev"/>.</p> -<p></p> +</s2><anchor name="xalanns"/> +<s2 title="Xalan namespace"> +<p>Where it makes sense, we are placing the new Xalan extensions in the org.apache.xalan.lib.Extensions class, and (strictly for ease of use) we have defined a namespace for this class:</p> +<p> <code>http://xml.apache.org/xalan</code>.</p> +<p>To call any of the extensions implemented in org.apache.xalan.lib.Extensions, you can define this namespace in your stylesheet element, and call the extension using the namespace prefix you have associated with that namespace.</p> +<note>You do not need to include an extension-element-prefixes attribute for this namespace.</note> +<p>For an example that uses this namespace, see <link anchor="ex-nodeset">Example with the nodeset extension function</link>.</p> </s2><anchor name="redirect"/> - <s2 title= "Redirect"> <p>A standard XSL transformation involves an XSL stylesheet, an XML source tree, and the transformation result tree. The transformation sends the entire result to a single <jump href="apidocs/org/apache/trax/Result.html">org.apache.trax.Result</jump> object.</p> <p>The Redirect extension @@ -152,11 +158,54 @@ <foobar-out>foo subelement text node</foobar-out> </foo-out></source> <p>For more information on using the Redirect extension to send output to multiple files, examine the <link idref="samples" anchor="ext1">SimpleRedirect</link> sample and see the <jump href="apidocs/org/apache/xalan/lib/Redirect.html">Redirect</jump> class Javadoc.</p> -</s3> - -</s2><anchor name="nodeset"/> +</s3></s2><anchor name="nodeset"/> <s2 title= "nodeset"> -<p><em>To be ported.</em> This extension function casts a result tree fragment into a node-set. Gary L. Peskin posted nodeset to &xslt4j; version 1, and it needs to be ported to &xslt4j2;.</p> +<p>Implemented in <jump href="apidocs/org/apache/xalan/lib/Extensions.html">org.apache.xalan.lib.Extensions</jump>, +<code>nodeset (result-tree-fragment)</code> casts a result tree fragment into a node-set.</p> +<anchor name="ex-nodeset"/> +<s3 title="Example with the nodeset extension function"> +<p>The following stylesheet uses the nodeset() extension function to cast a result tree fragment into a node-set. It uses the http://xml.apache.org/xalan namespace to provide access to nodeset(), a method in xml.apache.xalan.lib.Extensions.</p> +<source><?xml version="1.0"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" + xmlns:xalan="http://xml.apache.org/xalan" + exclude-result-prefixes="xalan"> +<xsl:template match="/"> + <out> + <xsl:variable name="rtf"> + <docelem> + <elem1> + <elem1a>ELEMENT1A</elem1a> + <elem1b>,ELEMENT1B</elem1b> + </elem1> + <elem2> + <elem2a>ELEMENT2A</elem2a> + </elem2> + </docelem> + </xsl:variable> + <xsl:for-each select="xalan:nodeset($rtf)/docelem/*"> + <xsl:value-of select="name(.)"/><xsl:text>,</xsl:text> + </xsl:for-each> + </out> +</xsl:template> +</xsl:stylesheet></source> +</s3> +</s2><anchor name="intersection"/> +<s2 title="intersection"> +<p>Implemented in <jump href="apidocs/org/apache/xalan/lib/Extensions.html">org.apache.xalan.lib.Extensions</jump>, +<code>intersection (node-set1, node-set2)</code> function returns a node-set with all nodes that are in ns1 and in ns2 .</p> +</s2><anchor name="difference"/> +<s2 title= "difference"> +<p>Implemented in <jump href="apidocs/org/apache/xalan/lib/Extensions.html">org.apache.xalan.lib.Extensions</jump>, +<code>difference(node-set1, node-set2)</code> returns a node-set with the nodes in node-set1 and not in node-set2.</p> +</s2><anchor name="distinct"/> +<s2 title= "distinct"> + <p>Implemented in <jump href="apidocs/org/apache/xalan/lib/Extensions.html">org.apache.xalan.lib.Extensions</jump>, + distinct (node-set) returns a node-set containing nodes with distinct string values. If more than one node in the node-set + contains the same text node value, distinct only returns the first of these nodes that it finds.</p> +</s2><anchor name="hassamenodes"/> +<s2 title= "hasSameNodes"> +<p>Implemented in <jump href="apidocs/org/apache/xalan/lib/Extensions.html">org.apache.xalan.lib.Extensions</jump>, +<code>hasSameNodes(node-set1, node-set2)</code> returns true if both node-set1 and node-set2 contain exactly the same set of nodes.</p> </s2><anchor name="sql"/> <s2 title= "SQL library"> <p>Provides extension functions for connecting to a JDBC data source, executing a query, @@ -228,24 +277,6 @@ </xsl:stylesheet> </source> </s3> -</s2><anchor name="intersection"/> -<s2 title="intersection"> -<p>Implemented in <jump href="apidocs/org/apache/xalan/lib/NodeSetOperations.html">org.apache.xalan.lib.NodeSetOperations</jump>, -<code>intersection (node-set1, node-set2)</code> function returns a node-set with all nodes that are in ns1 and in ns2 .</p> -</s2><anchor name="difference"/> - -<s2 title= "difference"> -<p>Implemented in <jump href="apidocs/org/apache/xalan/lib/NodeSetOperations.html">org.apache.xalan.lib.NodeSetOperations</jump>, -<code>difference(node-set1, node-set2)</code> returns a node-set with the nodes in node-set1 and not in node-set2.</p> -</s2><anchor name="distinct"/> -<s2 title= "distinct"> - <p>Implemented in <jump href="apidocs/org/apache/xalan/lib/NodeSetOperations.html">org.apache.xalan.lib.NodeSetOperations</jump>, - distinct (node-set) returns a node-set containing nodes with distinct string values. If more than one node in the node-set - contains the same text node value, distinct only returns the first of these nodes that it finds.</p> -</s2><anchor name="hassamenodes"/> -<s2 title= "hasSameNodes"> -<p>Implemented in <jump href="apidocs/org/apache/xalan/lib/NodeSetOperations.html">org.apache.xalan.lib.NodeSetOperations</jump>, -<code>hasSameNodes(node-set1, node-set2)</code> returns true if both node-set1 and node-set2 contain exactly the same set of nodes.</p> </s2><anchor name="evaluate"/> <s2 title= "evaluate">
