dleslie 01/06/08 13:16:06
Modified: c/xdocs/sources/xalan extensions.xml
Log:
Revised per XalanTransformer interfaces (assuming methods for globall
installation/uninstallation of external functions which do not yet exist.
Revision Changes Path
1.13 +17 -38 xml-xalan/c/xdocs/sources/xalan/extensions.xml
Index: extensions.xml
===================================================================
RCS file: /home/cvs/xml-xalan/c/xdocs/sources/xalan/extensions.xml,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- extensions.xml 2001/02/14 20:10:50 1.12
+++ extensions.xml 2001/06/08 20:16:06 1.13
@@ -91,26 +91,11 @@
#include <cmath>
#include <ctime>
-#include <iostream>
-#include <fstream>
#include <util/PlatformUtils.hpp>
-#include <PlatformSupport/DOMStringHelper.hpp>
-#include <DOMSupport/DOMSupportDefault.hpp>
-#include <XPath/XObjectFactoryDefault.hpp>
-#include <XPath/XPath.hpp>
-#include <XPath/XPathSupportDefault.hpp>
-#include <XPath/XPathFactoryDefault.hpp>
-#include <XSLT/StylesheetConstructionContextDefault.hpp>
-#include <XSLT/StylesheetExecutionContextDefault.hpp>
-#include <XSLT/XSLTEngineImpl.hpp>
-#include <XSLT/XSLTInputSource.hpp>
-#include <XSLT/XSLTProcessorEnvSupportDefault.hpp>
-#include <XSLT/XSLTResultTarget.hpp>
+#include <XalanTransformer/XalanTransformer.hpp>
+#include <XPath/XObjectFactory.hpp>
-#include <XercesParserLiaison/XercesDOMSupport.hpp>
-#include <XercesParserLiaison/XercesParserLiaison.hpp>
-
// This class defines a function that will return the square root
// of its argument.
class FunctionSquareRoot : public Function
@@ -127,7 +112,7 @@
* @param args vector of pointers to XObject arguments
* @return pointer to the result XObject
*/
- virtual XObject*
+ virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
@@ -173,33 +158,27 @@
}</source>
</s2><anchor name="install"/>
<s2 title="Installing an extension function">
-<p>When you set up an XSLT processor, you instantiate an
XSLTProcessorEnvSupportDefault object, which provides
-methods for installing (and uninstalling) extension functions:</p>
+<p><jump href="apdidocs/class_xalantransformer.html">XalanTransformer</jump>
provides methods for installing and unistalling external functions:</p>
<ul>
- <li>installExternalFunctionGlobal() is a static method for making a
function available globally</li>
- <li>installExternalFunctionLocal() makes the function available to the
XSLTProcessorEnvSupport instance in which the function is
- installed.</li>
+<li>installExternalFunction() makes the function available in the current
instance of XalanTransformer. Use uninstallExternalFunction() to remove the
function.<br/><br/></li>
+<li>installExternalFunctionGlobal() makes the function available globally.
Use uninstallExternalFunctionGlobal() to remove the function. The global
functions are static.</li>
</ul>
<p>These methods include arguments for the namespace, the function name, and
the function implementation.</p>
-<note>These XSLTProcessorEnvSupportDefault methods call
XPathEnvSupportDefault methods of the same name which provide
-the actual implementation.</note>
<p>When you install an extension function, the function inhabits the
namespace you designate. For information about XML namespaces, see <jump
href="http://www.w3.org/TR/REC-xml-names/">Namespaces in XML</jump>.</p>
-<p>The following code fragment installs the square root function defined
above as a global function, and binds it to the extension-function name
"square-root" in the namespace "http://ExternalFunction.xalan-c.xml.apache.org"
so it can be accessed from stylesheets. Keep in mind that the function name
does not need to be the same as the name of the function class, and that a
function name may be used more than once provided that each function with that
name is installed in a different namespace.</p>
-<source>// You have created a header file for FunctionSquareRoot.
+<p>The following code fragment installs locally the square root function
defined above, and binds it to the extension-function name "square-root" in the
namespace "http://ExternalFunction.xalan-c.xml.apache.org" so it can be
accessed from stylesheets. Keep in mind that the function name does not need to
be the same as the name of the function class, and that a function name may be
used more than once provided that each function with that name is installed in
a different namespace.</p>
+<source>#include <Include/PlatformDefinitions.hpp>
+#include <util/PlatformUtils.hpp>
+#include <XalanTransformer/XalanTransformer.hpp>
+// You have created a header file for FunctionSquareRoot.
#include <MyFunctions/FunctionSquareRoot.hpp>
// The namespace...
const XalanDOMString
- theNamespace("http://ExternalFunction.xalan-c.xml.apache.org");
-// Install the function in the global space so all processor
-// instances can use it.
-XSLTProcessorEnvSupportDefault::installExternalFunctionGlobal(
- theNamespace,
- "square-root",
- FunctionSquareRoot());</source>
-<note>We do not recommend this, but you can also install a function directly
into the XPath function table, in which
-case it is not really an extension function. The XPath parser treats it like
any other XPath function, and no namespace declaration or prefix is
involved.</note>
-<p>For an example that installs a global extension function, a local
extension function, and adds a function to the
- XPath function table, see the <link idref="samples"
anchor="externalfunctions">External Functions</link> sample.</p>
+ theNamespace("http://ExternalFunction.xalan-c++.xml.apache.org");
+
+theXalanTransformer.installExternalFunction(theNamespace,
+ XalanDOMString("square-root"),
+ FunctionSquareRoot());</source>
+<p>For an example that installs three functions, see the <link
idref="samples" anchor="externalfunctions">External Functions</link> sample.</p>
</s2><anchor name="use"/>
<s2 title="Using an extension function">
<p>To use the extension function in a stylesheet, you must do the
following:</p>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]