Graydon,
There's almost certainly a much nicer way to do this - eg the examples
you've provided - but could another option be to build out a
`proc:execute()` call? It wouldn't be nearly as elegant, and may cause
additional processing in the output, but that way you would have full
access to command line Saxon options and  switches.

Best, (and apologies for the water cooler suggestion!)
Bridger


On Mon, Nov 8, 2021, 6:11 PM Graydon Saunders <graydon...@gmail.com> wrote:

> Hello --
>
> Somewhat to my surprise I've got the large XSLT 3.0 transform to load, or
> at least not complain about includes. (Load the input as a db; load the
> stylesheet from the file system. Be extra-careful about constructing
> URIs.)  Which raises the prospect that I'll actually be able to run this
> transform from BaseX, but I cannot figure out how to set a value for the
> initial template.
>
> This query:
>
> let $source := <dummy></dummy>
>
> let $template :=
> <xsl:stylesheet version="3.0" xmlns:xsl='
> http://www.w3.org/1999/XSL/Transform'>
>   <xsl:template name="xsl:initial-template">
>     <thingy>Hello, World!</thingy>
>   </xsl:template>
>
>   <xsl:template match="/">
>     <fail>matched on root</fail>
>   </xsl:template>
> </xsl:stylesheet>
>
> return xslt:transform($source,$template,map{'initial-template': '{
> http://www.w3.org/1999/XSL/Transform}initial-template'})
>
> returns
> <fail>matched on root</fail>
>
> Which isn't surprising; setting initial-template is a Saxon option, not a
> parameter.
>
> If I try
> return xslt:transform($source,$template,map{},map{'initial-template': '{
> http://www.w3.org/1999/XSL/Transform}initial-template'})
>
> I get [XPTY0004] Unknown option 'initial-template'. (same with 'it'.)
>
> Is there a way to set Saxon options with xslt:transform?
>
> Thanks!
> Graydon
>
>
>

Reply via email to