|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: java methods in SAXON
It is POSSIBLE ..
Following is an example -
XSLT file
---------
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ext="java:MyUtil"
version="2.0">
<xsl:output method="text" />
<xsl:template match="/">
1: <xsl:value-of select="ext:get(0)"
/><xsl:text>
</xsl:text>
2: <xsl:value-of select="ext:get(1)"
/><xsl:text>
</xsl:text>
3: <xsl:value-of select="ext:get(2)"
/><xsl:text>
</xsl:text>
4: <xsl:value-of select="ext:xyz()"
/><xsl:text>
</xsl:text>
5: <xsl:value-of select="ext:tab()" separator=","
/><xsl:text>
</xsl:text>
6: <xsl:value-of select="ext:tab()[1]" /> -
<xsl:value-of select="ext:tab()[2]" /> - <xsl:value-of
select="ext:tab()[3]" />
</xsl:template>
</xsl:stylesheet>
Java class
----------
public class MyUtil {
public static String[] tab = {"first", "second",
"third"};
public static String xyz = "hi...";
public static String get(int i) {
return tab[i];
}
public static void set(int i, String s) {
tab[i] = s;
}
}
Please put Java class into the JVM's classpath ..
Regards,
Mukul
--- Santosh N <ss1722@xxxxxxxxx> wrote:
> Hi,
>
> Is it possible to call a java a method from xslt if
> i am using SAXON
> parser.
>
> Guess this is possible in XALAN.
>
> Thanks
> Santosh
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Small Business - Try our new Resources site
> http://smallbusiness.yahoo.com/resources/
>
>
__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new Resources site
http://smallbusiness.yahoo.com/resources/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








