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%27%3E <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%7Dinitial-template%27%7D)
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%7Dinitial-template%27%7D)
I get [XPTY0004] Unknown option 'initial-template'. (same with 'it'.)
Is there a way to set Saxon options with xslt:transform?
Thanks! Graydon
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 graydonish@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%27%3E <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%7Dinitial-template%27%7D)
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%7Dinitial-template%27%7D)
I get [XPTY0004] Unknown option 'initial-template'. (same with 'it'.)
Is there a way to set Saxon options with xslt:transform?
Thanks! Graydon
On Mon, Nov 08, 2021 at 07:07:15PM -0500, Bridger Dyson-Smith scripsit:
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.
I had no idea proc:execute() was even there. I'd been looking for a BXS equivalent. (Step one; read all the docs. Step two; somehow retain all the docs.)
Best, (and apologies for the water cooler suggestion!)
An entirely helpful suggestion!
If I can get the transform step to behave, I am pretty sure I can manage the whole multi-step build-and-test process from a hierarchy of BXS calls with common configuration and that makes me happy. (Or at least much happier than the alternatives!)
Much appreciated!
Best, (and apologies for the water cooler suggestion!)
An entirely helpful suggestion!
I completely agree! Currently, we don’t provide support for vendor-specific transformation options, and it’s perfectly viable to run Saxon as external process and convert the result string back to XML.
basex-talk@mailman.uni-konstanz.de