Hi: > I'd like to use Xalan's XPath implementation with SVG documents loaded > by Batik (which, I assume, uses Xerces). I would like, though, to have > some extra functions available in the XPath expressions, which act just > like the core XPath functions.
Make your function class that must extends from org.apache.xpath.Expresion or some child and then include it use org.apache.xpath.compiler.FunctionTable.installFunction(String name, org.apache.xpath.Expresion exp); You can see org.apache.xpath.functions package to see how it works. I have implemented some extensions like equals_ignore_case, stop counters, xml result paging and some more. Then in your XSL file you can call your built-in function. I found in source it is limited to 30 built-in functions. Bye. ----- Original Message ----- From: "Cameron McCormack" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, June 17, 2003 12:36 PM Subject: Extending XPath with some functions > Hi everyone. > > I'd like to use Xalan's XPath implementation with SVG documents loaded > by Batik (which, I assume, uses Xerces). I would like, though, to have > some extra functions available in the XPath expressions, which act just > like the core XPath functions. > > I notice on this[1] page an example Java class called MyCounter. This > is then used in the XSLT stylesheet with the xalan:component element. > Now, since I don't have an XSLT document, just an SVG document (to which > I don't want to add any extension function looking things (like > xalan:component, a different namespace)) I don't know how to register a > class which has extension XPath functions in it with the XPath > implementation. I'm guessing it somehow needs to be given to the > XPathContext that each XPath will use. > > But how exactly do I do that? > > Thanks, > > Cameron > > [1] http://xml.apache.org/xalan-j/extensions.html > > -- > Cameron McCormack > // [EMAIL PROTECTED] > // http://www.csse.monash.edu.au/~clm/ > // icq 26955922 >