Does anyone have experience of registering a custom function with Xalan? I've looked at the examples on the apache website, but none address my specific situation.
I'm using a stylesheet that was created for a custom xslt engine which makes use of Xpath2.0 features, specifically the exists() function. We're now using the stylesheet with Xalan 2.6, which does not support Xpath2.0. So I need to write a custom exists() function and register it programatically in Java with Xalan. I've consulted the Apache website, and the examples typically involve creating extension functions in a custom namespace, then modifying the stylesheet to use these functions. In my case I am not able to modify the stylesheet. My question is can anyone give advice on how I provide and register an implementation of exists() with the Xalan engine so it can process my stylesheet? This new function must exist in the default namespace i.e. I'm not able to add extra namespace tags to the stylesheet. The following stylesheet has to work with Xalan Java 2.6 <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:fn="http://www.w3.org/2005/02/xpath-functions" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns="http://www.tibco.com/xmlns/ae2xsd/2002/05/ae/ADB/ActiveDatabas eAdapterConfiguration" version="1.0" exclude-result-prefixes="xsi xsd"> <xsl:output method="xml"/> <xsl:param name="SW_FIELDS"/> <xsl:template match="/"> <ns:P__CUSTOMER__IP> <CUSTID> <xsl:choose> <xsl:when test="exists($SW_FIELDS/user_fields/PARAM1)"> <xsl:value-of select="$SW_FIELDS/user_fields/PARAM1"/> </xsl:when> <xsl:otherwise> <xsl:attribute name="xsi:nil">true</xsl:attribute> </xsl:otherwise> </xsl:choose> </CUSTID> </ns:P__CUSTOMER__IP> </xsl:template> </xsl:stylesheet> Any examples would be very useful. Thanks for any help. Andrew.
