[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: java methods in SAXON

Subject: Re: java methods in SAXON
From: Mukul Gandhi <mukul_gandhi@xxxxxxxxx>
Date: Wed, 25 May 2005 20:18:40 -0700 (PDT)
tab methods java
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>&#xa;</xsl:text>
   2: <xsl:value-of select="ext:get(1)"
/><xsl:text>&#xa;</xsl:text>
   3: <xsl:value-of select="ext:get(2)"
/><xsl:text>&#xa;</xsl:text>   
   4: <xsl:value-of select="ext:xyz()"
/><xsl:text>&#xa;</xsl:text>
   5: <xsl:value-of select="ext:tab()" separator=","
/><xsl:text>&#xa;</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/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.