[xquery-talk] fn:transform running with default call-template invocation - no result-documents created

Ihe Onwuka ihe.onwuka at gmail.com
Thu Feb 11 09:35:15 PST 2021


Posted on SO. It happens on Saxon 10.3 btw.

https://stackoverflow.com/questions/66159827/fntransform-running-with-default-call-template-invocation-no-result-documents

On Thu, Feb 11, 2021 at 9:27 AM Ihe Onwuka <ihe.onwuka at gmail.com> wrote:

> This transform test.xsl copies (for the purpose of a small test example) a
> directory of XML data by calling an identity transform for each recursively
> encountered XML file.
>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xmlns:xs="http://www.w3.org/2001/XMLSchema"
>                 xmlns:fn="http://www.w3.org/2005/xpath-functions"
>                 xmlns:map="http://www.w3.org/2005/xpath-functions/map"
> version="3.0" exclude-result-prefixes="xsi fn xs map" expand-text="yes">
>    <xsl:output method="xml" indent="yes"/>
>    <xsl:strip-space elements="*"/>
>
>    <xsl:variable name="currentStylesheet" as="document-node()"
> select="doc('identity.xsl')"/>
>    <xsl:template name="xsl:initial-template">
>       <xsl:for-each
> select="collection('file:///mnt/c/home/oneD/data/translatable' ||
> '?select=*.xml;recurse=yes')">
>          <xsl:result-document
> href="{replace(document-uri(),'/data/translatable/','/translated/')}">
>               <xsl:sequence select=" fn:transform(map {
>                                    'stylesheet-node' :  $currentStylesheet,
>                                    'source-node'     :  .
>                        })?output"/>
>          </xsl:result-document>
>       </xsl:for-each>
>    </xsl:template>
>  </xsl:stylesheet>
>
> However if I invoke it from XQuery with fn:transform like so
>
> xquery version "3.1";
> fn:transform(map { 'stylesheet-node' :  doc('test.xsl')})?output
>
> none of the result-documents are created.
>
> Is there something wrong with the invoking XQuery? I have never before
> tried this so it is my best attempt from reading the docs.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://x-query.com/pipermail/talk/attachments/20210211/8018b121/attachment.html>


More information about the talk mailing list