[xsl] Using a Java Function in XSLT

Subject: [xsl] Using a Java Function in XSLT
From: Jeff Sese <jsese@xxxxxxxxxxxx>
Date: Thu, 25 Oct 2007 11:24:11 +0800
Hi,

I have a java application that hyphenates words based on a wordlist. This application accepts an XML file as input and then use a sax filer to hyphenate the words. However, there was a new requirement that ask if the application can be changed so that instead of applying the hyphenation to the whole XML file, it will only hyphenate chunks of the XML file based on an XPath expression.

Now as my application accepts XML file, I was thinking if it is possible if I can pass a chunk of the XML file that matches a certain xpath to my application via XSLT (I want to apply templates to the now hyphenated XML chunk). Something to this effect:

<xsl:template match="some.node">
<xsl:variable name="copy.of" as="node()" select="."/>
<!-- xsl instruction to call my java app (don't know the correct syntax)-->
<xsl:apply-templates select="my:java-app($copy.of)"/>
</xsl:template>


Is this possible?

Thanks,
Jeff

Current Thread