xsl-list
[Top] [All Lists]

RE: [xsl] Accessing External Java Library

2007-11-01 08:51:46
The external class now loads OK but I think my xslt is wrong 
somewhere?

Like the message says:   

XTSE0010: xsl:param must be the first element within a template or function

i.e. you can't have xsl:value-of before xsl:param. 

Michael Kay
http://www.saxonica.com/


Any guidance would much appreciated!

XML:

<dataelements>
    <dataelement>
        <data>New York</data>
    </dataelement>
    <dataelement>
        <data>Boston</data>
     </dataelement>
     <dataelement>
        <data>Denver</data>
     </dataelement>
</dataelements>

XSLT:

<?xml version="1.0" ?>
<xsl:stylesheet version="2.0" 
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
      xmlns:PGP="iPGP.iPGP"
      exclude-result-prefixes="PGP">

<xsl:template match="dataelements">
   <xsl:value-of select="PGP:setArmor(true()),
    PGP:setConventional(true()),
    PGP:setInputIsText(true()), 
    PGP:setOutputIsText(true())"/>

   <xsl:param name="passphrase">mypswd</xsl:param>
   <xsl:param name="asciiresult"></xsl:param>
   <xsl:param name="errormessage"></xsl:param>

   <xsl:variable name="datain" select="data"/>
   <xsl:variable name="encryptData" 
select="PGP:encrypt($passphrase, $datain, $asciiresult, 
$errormessage)"/>
   <xsl:value-of select="$encryptData"/> </xsl:template> 
</xsl:stylesheet>

Output: 

C:\Documents and Settings\cbourne\My 
Documents\PGPJava\saxon8>java -cp .;C:\java pgp\iPGP.jar 
net.sf.saxon.Transform -TJ ..\pgp.xml ..\pgp.xslt Loading 
iPGP.iPGP Looking for method setArmor in Java class class 
iPGP.iPGP Number of actual arguments = 1 Trying method 
getArmor: name does not match Trying method setArmor: name 
matches Method is not static Method has 1 argument; expecting 
0 Trying method getConventional: name does not match Trying 
method setConventional: name does not match Trying method 
getInputIsText: name does not match Trying method 
setInputIsText: name does not match Trying method 
getOutputIsText: name does not match Trying method 
setOutputIsText: name does not match Trying method 
getUseKeyID: name does not match Trying method setUseKeyID: 
name does not match Trying method getOutputFilename: name 
does not match Trying method setOutputFilename: name does not 
match Trying method getASCIIOutput: name does not match 
Trying method getPGPSDKErrorMessage: name does not match 
Trying method encrypt: name does not match Trying method 
encryptAndSign: name does not match Trying method 
decryptAndVerify: name does not match Trying method hashCode: 
name does not match Trying method getClass: name does not 
match Trying method wait: name does not match Trying method 
wait: name does not match Trying method wait: name does not 
match Trying method equals: name does not match Trying method 
toString: name does not match Trying method notify: name does 
not match Trying method notifyAll: name does not match No 
method or field matching setArmor with 1 parameter found in 
class iPGP.iPGP Error at xsl:value-of on line 11 of 
file:/C:/Documents%20and%20Settings/cbourne/
My%20Documents/PGPJava/saxon8/../pgp.xslt:
  XPST0003: XPath syntax error at char 20 on line 11 in 
{...ue()), PGP:setConven
tional}:
    Cannot find a matching 1-argument function named
{iPGP.iPGP}setArmor()
Loading iPGP.iPGP
Looking for method encrypt in Java class class iPGP.iPGP 
Number of actual arguments = 4 Trying method getArmor: name 
does not match Trying method setArmor: name does not match 
Trying method getConventional: name does not match Trying 
method setConventional: name does not match Trying method 
getInputIsText: name does not match Trying method 
setInputIsText: name does not match Trying method 
getOutputIsText: name does not match Trying method 
setOutputIsText: name does not match Trying method 
getUseKeyID: name does not match Trying method setUseKeyID: 
name does not match Trying method getOutputFilename: name 
does not match Trying method setOutputFilename: name does not 
match Trying method getASCIIOutput: name does not match 
Trying method getPGPSDKErrorMessage: name does not match 
Trying method encrypt: name matches Method is not static 
Method has 4 arguments; expecting 3 Trying method 
encryptAndSign: name does not match Trying method 
decryptAndVerify: name does not match Trying method hashCode: 
name does not match Trying method getClass: name does not 
match Trying method wait: name does not match Trying method 
wait: name does not match Trying method wait: name does not 
match Trying method equals: name does not match Trying method 
toString: name does not match Trying method notify: name does 
not match Trying method notifyAll: name does not match No 
method or field matching encrypt with 4 parameters found in 
class iPGP.iPGP Error at xsl:variable on line 18 of 
file:/C:/Documents%20and%20Settings/cbourne/
My%20Documents/PGPJava/saxon8/../pgp.xslt:
  XPST0003: XPath syntax error at char 62 on line 18 in {..., 
$asciiresult, $err
ormessa...}:
    Cannot find a matching 4-argument function named
{iPGP.iPGP}encrypt()
Error at xsl:param on line 13 of
file:/C:/Documents%20and%20Settings/cbourne/My%
20Documents/PGPJava/saxon8/../pgp.xslt:
  XTSE0010: xsl:param must be the first element within a 
template or function Error at xsl:param on line 14 of 
file:/C:/Documents%20and%20Settings/cbourne/My%
20Documents/PGPJava/saxon8/../pgp.xslt:
  XTSE0010: xsl:param must be the first element within a 
template or function Error at xsl:param on line 15 of 
file:/C:/Documents%20and%20Settings/cbourne/My%
20Documents/PGPJava/saxon8/../pgp.xslt:
  XTSE0010: xsl:param must be the first element within a 
template or function Failed to compile stylesheet. 5 errors detected.



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--