amiro 2002/08/02 11:46:45
Modified: java/xdocs/sources/xalan xsltc_constraints.xml
Log:
changed verbage to agree with new support of constructors and nonstatic
external java functions
Revision Changes Path
1.37 +40 -7 xml-xalan/java/xdocs/sources/xalan/xsltc_constraints.xml
Index: xsltc_constraints.xml
===================================================================
RCS file: /home/cvs/xml-xalan/java/xdocs/sources/xalan/xsltc_constraints.xml,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- xsltc_constraints.xml 25 Jul 2002 15:22:25 -0000 1.36
+++ xsltc_constraints.xml 2 Aug 2002 18:46:45 -0000 1.37
@@ -33,12 +33,11 @@
<p>XSLTC supports a number of features that are not required by the XSLT 1.0
specification,
but which are supported by a number of other XSLT processors:</p>
<ul>
- <li><em>Calling external Java methods from a Translet.</em><br/>
- At the time of writing, only static methods are supported. A call to a
function
- whose namespace is either
<code><http://xml.apache.org/xslt/java</code>
- or <code><http://xml.apache.org/xalan/xsltc/java</code>
- is resolved by loading the appropriate class and calling a static method
that
- matches the signature of the function. The class can be specified as
part
+ <li><em>Calling external Java functions from a Translet.</em><br/>
+ Constructors, static, and nonstatic functions are supported. You may use
+ either the <code><http://xml.apache.org/xslt/java</code>
+ or the <code><http://xml.apache.org/xalan/xsltc/java</code> namespace
to
+ call your external function. The class can be specified as part
of the namespace URI or as part of the function call as shown in the
following
example:<br/>
<source> <xsl:stylesheet version="1.0"
@@ -49,7 +48,41 @@
<xsl:value-of
select="java:java.lang.System.currentTimeMillis()"/>
<xsl:value-of select="java-system:currentTimeMillis()"/>
</xsl:template>
-</xsl:stylesheet></source><br/></li>
+ </xsl:stylesheet></source><br/>
+ The following example shows you how to call constructors, static, and
nonstatic functions<br/>
+
+ <source><xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:java="http://xml.apache.org/xslt/java"
+ exclude-result-prefixes="java">
+
+ <!--
+ * test: construction of Date object using a parameter calculated
+ * by a static call to the java.lang.Math object. Then call
+ * a non-static method (getTime()) on the newly created Date
+ * object. Demonstrates calling constructors, static functions
+ * (Math.max) and non-static functions (getTime()).
+ *
+ * Output:
+ * <?xml version="1.0" encoding="UTF-8"?>
+ * Date of object: Sat Nov 30 17:32:41 EST 2002
+ * Time of object: 1038695561000
+ *
+ -->
+
+ <xsl:template match="/">
+ <!-- create Date object with calculated parameter -->
+ <xsl:variable name="dateObject"
+ select="java:java.util.Date.new(
+ java:java.lang.Math.max(1027695561000,1038695561000)
+ )"/>
+ Date of object: <xsl:value-of select="$dateObject"/>
+ Time of object: <xsl:value-of
select="java:getTime($dateObject)"/>
+ </xsl:template>
+
+ </xsl:stylesheet>
+ </source><br/>
+ </li>
<li><em>Result Tree Fragments as Node Sets</em><br/>
Result Tree Fragments (RTFs) can be captured as the template content of
a
variable or parameter and then the variable can be passed to a for-each
or
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]