[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] how to pass arguments to xt extension functions ?
I am trying to figure out how to pass string arguments to xt extension functions. I can not get the following to work: <xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0" xmlns:w="http://www.jclark.com/xt/java/sqlxml" > <xsl:template match="cis"> <xsl:variable name="this" expr="w:new()" /> <xsl:variable name="usr" expr="@name" /> <xsl:value-of select="$usr" /> <!-- this returns the correct value --> <xsl:value-of select="w:con1($this, string($usr) )" /> <!-- this yields an illegal arguments error --> </xsl:template> </xsl:stylesheet> where the xml is: <cis name="sa"> <database>jdbc:odbc:cis </database> </cis> and where con1 is declared as: public String con1 (String user) I must be missing something obvious here. Below are two working examples that correctly handle this arguments and strings. I just can't the combined example to work.... I have tried numerious variations, but suggestions would be welcomed! Or if anyone has got this working I would love to get a definitive answer. Thanks to all! ------------------these samples work ------------------- ------------------together they show how to ------------------use this pointers and how to ------------------use string arguments..... Here is short demo that works: <xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0" xmlns:w="http://www.jclark.com/xt/java/com.jclark.xsl.sax.TextFileWriter"> <xsl:template match="file"> <xsl:variable name="file" expr="@name"/> <xsl:variable name="contents"><xsl:apply-templates/></xsl:variable> <!-- --> <xsl:value-of select="w:write($contents, string($file) )" /> </xsl:template> </xsl:stylesheet> where write is declared as : static public void write(ResultTreeFragment frag, String file) -------------------------------- -------------------------------- this also works: <xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0" xmlns:w="http://www.jclark.com/xt/java/sqlxml" > <xsl:template match="cis"> <xsl:variable name="this" expr="w:new()" /> <xsl:variable name="usr"> <xsl:value-of select="user" /> </xsl:variable> <xsl:value-of select="w:con($this )" /> </xsl:template> </xsl:stylesheet> where con is declared public String con () Brian Smith XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|