dleslie 00/10/18 05:50:32
Modified: java/xdocs/sources/xalan extensionslib.xml Log: Beefed up nodeset description and example. Revision Changes Path 1.6 +12 -7 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.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- extensionslib.xml 2000/10/17 21:57:56 1.5 +++ extensionslib.xml 2000/10/18 12:50:31 1.6 @@ -80,7 +80,7 @@ <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> +extensions in an extensions library distributed with &xslt4j;. If you have ideas and/or contributions you would like to make, please email us at the <human-resource-ref idref="xalandev"/>.</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> @@ -159,8 +159,9 @@ <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"/> <s2 title= "nodeset"> -<p>Implemented in <jump href="apidocs/org/apache/xalan/lib/Extensions.html">org.apache.xalan.lib.Extensions</jump>, +<p>Implemented in <jump href="apidocs/org/apache/xalan/lib/Extensions.html">org.apache.xalan.lib.Extensions</jump>,<br/> <code>nodeset (result-tree-fragment)</code> casts a result tree fragment into a node-set.</p> +<note>When you bind a variable to a template, rather than to the value generated by a select expression, the data type of the variable is result tree fragment. For more information, see <jump href="http://www.w3.org/TR/xslt#section-Result-Tree-Fragments">Result Tree Fragments</jump>.</note> <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 that can then be navigated in standard XPath manner. It uses the http://xml.apache.org/xalan namespace to provide access to the nodeset() method in xml.apache.xalan.lib.Extensions.</p> @@ -181,29 +182,33 @@ </elem2> </docelem> </xsl:variable> - <xsl:for-each select="xalan:nodeset($rtf)/docelem/*"> + <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> +<p>The output of running this stylesheet (with any XML input source) is a comma-delimited list of the element names in the node-set<br/> + <code><out>elem1,elem1a,elem1b,elem2,elem2a</out></code></p> +<note>For illustration purposes, the preceding stylesheet pays no attention to the structure and content of the XML input document. Instead, it processes the template (in the stylesheet) bound to the variable named rtf.</note> + </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>, +<p>Implemented in <jump href="apidocs/org/apache/xalan/lib/Extensions.html">org.apache.xalan.lib.Extensions</jump>,<br/> <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>, +<p>Implemented in <jump href="apidocs/org/apache/xalan/lib/Extensions.html">org.apache.xalan.lib.Extensions</jump>,<br/> <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>, + <p>Implemented in <jump href="apidocs/org/apache/xalan/lib/Extensions.html">org.apache.xalan.lib.Extensions</jump>,<br/> 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>, +<p>Implemented in <jump href="apidocs/org/apache/xalan/lib/Extensions.html">org.apache.xalan.lib.Extensions</jump>,<br/> <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">
