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.
_______________________________________________
talk@x-query.com
http://x-query.com/mailman/listinfo/talk

Reply via email to