XSLT Module, how to specify XSLT's Initial Template name
Hello, I am using BaseX 12.4 and its XSLT Module. The XSLT engine is SaxonHE13-0J, so the XSLT 3.0 standard could be used! My XSLT needs to process XML files in a directory on the file system. The XSLT is implementing a so called Modified Identity Transform pattern. Unfortunately, it seems it is impossible to pass "-it", i.e. Initial Template name parameter. I tried 2 lines XQuery as follows: XQuery ========== declare variable $stylesheet as xs:string external; xslt:transform("<dummy/>", $stylesheet, { "-it": "xsl:initial-template" }) The XSLT is using an Initial Template <xsl:template name="xsl:initial-template"> So, I tried to pass it in BaseX as a parameter to no avail. The XSLT is working properly in Oxygen XML IDE when the "-it" parameter is specified. Please see below a full repro. XML files have the following (simplified) structure: ==================================================== <root> <body> <text> <text>second level text</text> <text>second level text</text> </text> </body> </root> XSLT =========== <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform version="3.0"> <xsl:output indent="yes" method="xml"/> <xsl:mode on-no-match="shallow-copy"/> <xsl:param name="input_dir" select="'file:///c:/XSLT30/Process Multiple XML Files?select=*.xml'"/> <xsl:param name="output-dir" select="'file:///c:/XSLT30/Process Multiple XML Files/Output/'"/> <xsl:template name="xsl:initial-template"> <xsl:for-each select="collection($input_dir)"> <xsl:variable name="input_fileName" select="tokenize(base-uri(.), '/')[last()]"/> <xsl:variable name="output_fileName" select="'new_' || $input_fileName"/> <xsl:result-document href="{$output-dir || $output_fileName}"> <xsl:apply-templates /> </xsl:result-document> </xsl:for-each> </xsl:template> <xsl:template match="text/text"> <comment> <xsl:apply-templates/> </comment> </xsl:template> </xsl:stylesheet> Regards, Yitzhak Khabinsky Regards, Yitzhak Khabinsky
participants (1)
-
ykhabins@bellsouth.net