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

[no subject]

[no subject]
The iPGP.jar file is in the same directory as the saxon8.jar and the
xml, xslt files.

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>java -jar
saxon8.jar -TJ
pgp.xml pgp.xslt
Loading iPGP.iPGP
No Java class iPGP.iPGP could be loaded
Error at xsl:value-of on line 11 of
file:/C:/Documents%20and%20Settings/cbourne/
My%20Documents/PGPJava/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
No Java class iPGP.iPGP could be loaded
Error at xsl:variable on line 18 of
file:/C:/Documents%20and%20Settings/cbourne/
My%20Documents/PGPJava/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/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/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/pgp.xslt:
  XTSE0010: xsl:param must be the first element within a template or
function
Failed to compile stylesheet. 5 errors detected.




Carl Bourne
Intellect
DDI: +44 1491 842502
M: +44 7770 284294





-----Original Message-----
From: Michael Kay [mailto:mike@xxxxxxxxxxxx]
Sent: 01 November 2007 12:59
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  Accessing External Java Library

>
> Before calling the external Java library I need to set some
> attributes, e.g.
>
> pgp.setArmor(true)
> pgp.setConventional(true)
> pgp.setInputIsText(true)
> pgp.setOutputIsText(true)
>
> Is it possible to do this within the style sheet?

Yes, if you're careful. The problem is that these methods don't generate
any
output, so there's a risk that they can get optimized away (or called in
the
wrong order). The trick is to use them as if they were returning
something,
and that something were written to your result tree, for example

<out>
  <xsl:value-of select="PGP:setArmor(true()),
PGP:setConventional(true()),
PGP: ...etc"/>
>
> Also the XSLT programmers reverence seems to imply that only
> static types are supported - is this the case?
>
No. The behaviour of extension functions varies from product to product
and
release to release. The documentation for Saxon 8.9 is at

http://www.saxonica.com/documentation/extensibility/functions.html

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

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.