You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by David N Bertoni/Cambridge/IBM <da...@us.ibm.com> on 2002/03/06 00:51:04 UTC

Re: InstallExternalFunction in XalanCAPI

The reason there's no way to install an external function in the C API is
that we assume you're using the C language.  Thus, there would be no way
for you to write an extension function, since that requires using C++.  If
you look at the APIs, you will see that there is no use of classes, or any
other C++ language features.

If you're using C++, you might want to just use the XalanTransformer class.
That's a bit more efficient than the C API, and much more flexible.

Dave



                                                                                                                
                      Nouguier Olivier                                                                          
                      <olivier.nouguier@         To:      xalan-dev@xml.apache.org                              
                      wanadoo.fr>                cc:      olivier.nouguier@wanadoo.fr, (bcc: David N            
                                                 Bertoni/Cambridge/IBM)                                         
                      03/05/2002 05:31           Subject: InstallExternalFunction in XalanCAPI                  
                      PM                                                                                        
                      Please respond to                                                                         
                      xalan-dev                                                                                 
                                                                                                                
                                                                                                                



hi all,
             I was disapointed to see that there was not way to Install an
external
function with XalanCAPI. So I try to add the "wrapper" in the header
file and implementation

## XalanTransformer/XalanCAPI.h
XALAN_TRANSFORMER_EXPORT_FUNCTION(void)
        XalanInstallExternalFunction(XalanHandle theXalanHandle, const
char*, const char *, const Function& );
## XalanTransformer/XalanCAPI.cpp
XALAN_TRANSFORMER_EXPORT_FUNCTION(void)
XalanInstallExternalFunction(XalanHandle theXalanHandle, const char
*theNameSpace, const char *theFunctionName, const Function& theFunction
)
{
        getTransformer(theXalanHandle)->installExternalFunction(
XalanDOMString(theNameSpace), XalanDOMString( theFunctionName ),
theFunction );
}
##
And now it works in my apache xslt module. So I was wondering was this
function was not in XalanCAPI ( idem for uninstall ).

Sorry for my bad english, many thanks for xalan.









Re: InstallExternalFunction in XalanCAPI

Posted by Nouguier Olivier <ol...@wanadoo.fr>.
Okai, sorry if my question was stupid ... but I am using XalanCAPI to
write an ApacheXSLTModule of my own and I like to install external
function of Xalan extension librairies ( external:FunctionDistinct() ),
or in the future ( in I find a new idea you don't already implement )
build my own extension.

So did I miss something, I'm not an expert in relation between c and
c++, but what do you think is the best:
     - extend the xalanCAPI
     - use c++ and XalanTransformer to write my module with something
like : http://wolfgang.groogroo.com/apache-cplusplus/
     - another solution?

If you find my question really out of Xalan topic, I apologize.

Still many thanks.

Olivier

le mer 06-03-2002 à 00:51, David N Bertoni/Cambridge/IBM a écrit :
> 
> The reason there's no way to install an external function in the C API is
> that we assume you're using the C language.  Thus, there would be no way
> for you to write an extension function, since that requires using C++.  If
> you look at the APIs, you will see that there is no use of classes, or any
> other C++ language features.
> 
> If you're using C++, you might want to just use the XalanTransformer class.
> That's a bit more efficient than the C API, and much more flexible.
> 
> Dave
> 
>