Michael,
  So how would you have done it in xslt?  I am confused when with the whole typing thing here - the variable param seems to me to contain an element yet you call it a document node,  how would you send an element node?
 
Thanks
 
Martin


From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of Michael Kay
Sent: 27 June 2008 12:55
To: 'Mailing list for the SAXON XSLT and XQuery processor'
Subject: Re: [saxon] Saxon:transform example with parameters

This works for me (the function allows you to supply a document node, which is what you are doing, and treats it as equivalent to supplying the contained element).
 
Perhaps there is a namespace problem - for example it wouldn't work if filepath is in a namespace. Need to see more of your code.
 
Michael Kay
http://www.saxonica.com/


From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of martin.me.roberts@bt.com
Sent: 27 June 2008 11:44
To: saxon-help@lists.sourceforge.net
Subject: Re: [saxon] Saxon:transform example with parameters

So is the following correct $xsl and $content have been defined before.
 
    <xsl:variable name="param"><filepath><xsl:value-of select="$path"/></filepath></xsl:variable>
    <xsl:copy-of select="saxon:transform($xsl,$contents,$param)"/>
 
Using this I find that I do not get a value passed through to the spread sheet.
 
Martin


From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of Michael Kay
Sent: 27 June 2008 11:33
To: 'Mailing list for the SAXON XSLT and XQuery processor'
Subject: Re: [saxon] Saxon:transform example with parameters

Assuming you're in XQuery it might look like this:
 
let $results :=
  <customers>{ //customer[location="Scotland"] }</customers>
let $rendition := saxon:compile-stylesheet(doc('show-customers.xsl'))
return saxon:transform($rendition, $results, (<location-param>Scotland</location-param>, <debug>true</debug>))
Note that you can only pass in atomic values for parameters (not nodes), and unless you go to the trouble of schema-validating the parameters document, the values will be untypedAtomic.
If you're in XSLT, you'll have to set the parameters up in a variable and then reference the variable in the function call.
 
Michael Kay
Saxonica

From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of martin.me.roberts@bt.com
Sent: 27 June 2008 11:21
To: saxon-help@lists.sourceforge.net
Subject: [saxon] Saxon:transform example with parameters

Hi,
  could you please give an example of how you would pass a parameter into a stylesheet using the saxon:transform extension function.
 
  Thanks
 
Martin