|
| 1 | +(: |
| 2 | + : eXist-db Open Source Native XML Database |
| 3 | + : Copyright (C) 2001 The eXist-db Authors |
| 4 | + : |
| 5 | + |
| 6 | + : http://www.exist-db.org |
| 7 | + : |
| 8 | + : This library is free software; you can redistribute it and/or |
| 9 | + : modify it under the terms of the GNU Lesser General Public |
| 10 | + : License as published by the Free Software Foundation; either |
| 11 | + : version 2.1 of the License, or (at your option) any later version. |
| 12 | + : |
| 13 | + : This library is distributed in the hope that it will be useful, |
| 14 | + : but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | + : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | + : Lesser General Public License for more details. |
| 17 | + : |
| 18 | + : You should have received a copy of the GNU Lesser General Public |
| 19 | + : License along with this library; if not, write to the Free Software |
| 20 | + : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 21 | + :) |
| 22 | + |
| 23 | +xquery version "3.1"; |
| 24 | + |
| 25 | +module namespace testTransform="http://exist-db.org/xquery/test/function_transform"; |
| 26 | + |
| 27 | +declare namespace test="http://exist-db.org/xquery/xqsuite"; |
| 28 | + |
| 29 | +declare variable $testTransform:transform-33-xsl := "<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='3.0'> |
| 30 | + <xsl:template match='/'> <xsl:for-each select='//section'> |
| 31 | + <xsl:result-document href='section{position()}.html'> <!-- instructions content here --> |
| 32 | + </xsl:result-document> </xsl:for-each> |
| 33 | + </xsl:template> </xsl:stylesheet>"; |
| 34 | + |
| 35 | +declare variable $testTransform:transform-33-xml := "<doc> |
| 36 | + <section>sect1</section> |
| 37 | + <section>sect2</section> |
| 38 | + <section>sect3</section> |
| 39 | + </doc>"; |
| 40 | + |
| 41 | +declare |
| 42 | + %test:assertTrue |
| 43 | +function testTransform:transform-33() { |
| 44 | + let $xsl := $testTransform:transform-33-xsl |
| 45 | + let $xml := $testTransform:transform-33-xml |
| 46 | + let $result := fn:transform(map {"stylesheet-text": $xsl, "source-node": parse-xml($xml), |
| 47 | + "base-output-uri" : resolve-uri("transform/sandbox/fn-transform-33.xml", "http://www.w3.org/fots/fn/transform/staticbaseuri.xsl"), |
| 48 | + "delivery-format":"serialized"}) |
| 49 | + return (contains(string-join(map:keys($result)),"section2")) |
| 50 | +}; |
0 commit comments