Discussion:
[saxon] java setParameter() on transformer
Marc Pellmann
2007-08-23 07:54:15 UTC
Permalink
Hello!

I want to set an XML struktur as a parameter for an xsl tranformation
with saxon. I have read in an old mail from Michael Kay, that this
should work with a w3c Document. But it does not work for me.. the
result is [#document: null]. (In the script I do a copy-of of the param)
--
Viele Grüße / best regards

Marc Pellmann (Software Architect)

inubit - integrating your business and IT
inubit AG
Lützowstraße 105-106
D-10785 Berlin
Fon: +49.30. 72 61 12-132
Fax: +49.30. 72 61 12-100
Freecall: 0800-go inubit
Web: www.inubit.com

Vorstand: Dr. Torsten Schmale (Vorsitzender), Johannes Untiedt
Vorsitzender des Aufsichtsrates: Dr. Wolf-Dieter Klemt
Registergericht: AG Charlottenburg
Registernummer: HRB 80154
c***@daimlerchrysler.com
2007-08-23 08:16:15 UTC
Permalink
Hello,
Post by Marc Pellmann
I want to set an XML struktur as a parameter for an xsl
tranformation with saxon. I have read in an old mail from Michael
Kay, that this should work with a w3c Document. But it does not work
for me.. the result is [#document: null]. (In the script I do a
copy-of of the param)
I actually understand that you are doing something like:

<xsl:param name="xmlstructure" />

<xsl:template match="whatever">
<xsl:copy-of select="$xmlstructure" />
</xsl:template>

and when applying the stylesheet to some xml-document, you pass a value
for "xmlstructure" like this one:

transformer.setParameter("xmlstructure", "<test><subelement>this is a
test</subelement></test>");

I think (although I must admit that I never used it myself) that it should
be possible to parse the parameter into xml-nodes with
saxon:parse(...)

http://www.biglist.com/lists/xsl-list/archives/200205/msg00041.html

Greetings (from Stuttgart :))

Christoph


If you are not the intended addressee, please inform us immediately that you have received this e-mail by mistake and delete it. We thank you for your support.
Owen Rees
2007-08-23 09:00:15 UTC
Permalink
Post by Marc Pellmann
I want to set an XML struktur as a parameter for an xsl tranformation
with saxon. I have read in an old mail from Michael Kay, that this
should work with a w3c Document. But it does not work for me.. the
result is [#document: null]. (In the script I do a copy-of of the param)
The rules for converting Java objects supplied as stylesheet parameters are
described here:
<http://www.saxonica.com/documentation/extensibility/function-result.html>

It is not mentioned on that page but I think you may need to have
saxon8-dom.jar on your classpath for the DOM Node (including Document) case
to work.
--
Owen Rees
========================================================
Hewlett-Packard Limited. Registered No: 690597 England
Registered Office: Cain Road, Bracknell, Berks RG12 1HN
Marc Pellmann
2007-08-23 10:22:31 UTC
Permalink
Post by Owen Rees
Post by Marc Pellmann
I want to set an XML struktur as a parameter for an xsl tranformation
with saxon. I have read in an old mail from Michael Kay, that this
should work with a w3c Document. But it does not work for me.. the
result is [#document: null]. (In the script I do a copy-of of the param)
The rules for converting Java objects supplied as stylesheet parameters are
<http://www.saxonica.com/documentation/extensibility/function-result.html>
Thank you - I now use a javax.xml.transform.Source instance and it works
well!
--
Viele Grüße / best regards

Marc Pellmann (Software Architect)

inubit - integrating your business and IT
inubit AG
Lützowstraße 105-106
D-10785 Berlin
Fon: +49.30. 72 61 12-132
Fax: +49.30. 72 61 12-100
Freecall: 0800-go inubit
Web: www.inubit.com

Vorstand: Dr. Torsten Schmale (Vorsitzender), Johannes Untiedt
Vorsitzender des Aufsichtsrates: Dr. Wolf-Dieter Klemt
Registergericht: AG Charlottenburg
Registernummer: HRB 80154
Florent Georges
2007-08-23 10:50:26 UTC
Permalink
Owen Rees wrote:

Hi
Post by Owen Rees
The rules for converting Java objects supplied as
<http://www.saxonica.com/documentation/extensibility/function-result.html>
BTW Michael, this page says (the second and last items on
the list resp.):

- If the method returns null, the XPath value is an
empty sequence.

- If the result is any other Java object (including
null), it is returned as a "wrapped Java object".

I don't understand why you precise "including null".
Don't you refer to the case in which a null is returned, so
it is converted to an empty sequence?

Regards,

--drkm





















_____________________________________________________________________________
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail
Loading...