On 02/03/2012 15:58, Paul M wrote:
Thx! I think I am mixing command line jar vs java. Because it works from Java app fine...

-Paul


If you are calling from the command line, and the stylesheet expects an element node, all is not lost: you can supply a parameter in the form

Transform "?param=doc('abc.xml')/*"

where the leading "?" signals that the value of param is being supplied in the form of an XPath expression.

Michael Kay
Saxonica


From: Michael Kay <mike@saxonica.com>
To: saxon-help@lists.sourceforge.net
Sent: Wednesday, February 29, 2012 4:52 PM
Subject: Re: [saxon] XsltTransformer and parameters

On 29/02/2012 21:39, Paul M wrote:

Class XsltTransformer
has this function

public void setParameter(QName name,
                         XdmValue value)

Is it possible to pass an element? I do not follow this if it is possible.
An XdmNode is a (subclass of) XdmValue, so this method will accept an XdmNode.

I see XdmValue : XdmValue(Iterable<XdmItem> items)

But I do not see how to go from XdmNode to be used in setParameter...

Any basic examples taking  say <a>a</a> and passing it as parameter...Link to example?
If you're starting with lexical XML contained in a string, first create a StreamSource by wrapping the string in a StringReader and the StringReader in a StreamSource. Then calling DocumentBuilder.build() will convert this to an XdmNode.

Michael Kay
Saxonica

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help



------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/


_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help