@@ -25,13 +25,20 @@ module namespace testTransform="http://exist-db.org/xquery/test/function_transfo
25
25
import module namespace xmldb="http://exist-db.org/xquery/xmldb" ;
26
26
declare namespace test="http://exist-db.org/xquery/xqsuite" ;
27
27
28
- declare variable $testTransform:stylesheet := <xsl:stylesheet version = '1.0' xmlns:xsl = 'http://www.w3.org/1999/XSL/Transform' >
28
+ declare variable $testTransform:stylesheet1 := <xsl:stylesheet version = '1.0' xmlns:xsl = 'http://www.w3.org/1999/XSL/Transform' >
29
29
<xsl:param name = 'v' />
30
30
<xsl:template match = '/' >
31
31
<v><xsl:value-of select = '$v' /></v>
32
32
</xsl:template>
33
33
</xsl:stylesheet>;
34
34
35
+ declare variable $testTransform:stylesheet2 := <xsl:stylesheet version = '1.0' xmlns:xsl = 'http://www.w3.org/1999/XSL/Transform' >
36
+ <xsl:param name = 'v' />
37
+ <xsl:template name = 'named-template' match = '/' >
38
+ <v><xsl:value-of select = '$v' /></v>
39
+ </xsl:template>
40
+ </xsl:stylesheet>;
41
+
35
42
declare variable $testTransform:document := <document>
36
43
<catalog>
37
44
<book id = "bk101" >
@@ -60,9 +67,10 @@ declare
60
67
%test:setUp
61
68
function testTransform:setup() {
62
69
let $coll := xmldb:create-collection("/db", "regression-test")
63
- let $storeStylesheet := xmldb:store($coll, "stylesheet.xsl", $testTransform:stylesheet, "application/xslt+xml")
64
- return ( xmldb:store($coll, "document.xml", $testTransform:document, "application/document")
65
- )
70
+ let $storeStylesheet1 := xmldb:store($coll, "stylesheet1.xsl", $testTransform:stylesheet1, "application/xslt+xml")
71
+ let $storeStylesheet2 := xmldb:store($coll, "stylesheet2.xsl", $testTransform:stylesheet2, "application/xslt+xml")
72
+ let $storeDocument := xmldb:store($coll, "document.xml", $testTransform:document, "application/document")
73
+ return ()
66
74
};
67
75
68
76
declare
@@ -80,8 +88,27 @@ function testTransform:regression-test-1() {
80
88
let $in := parse-xml(" <dummy/>")
81
89
let $result := ( fn:transform(map{
82
90
" source-node ":$in,
83
- " stylesheet-node ":doc(" /db/regression-test/stylesheet .xsl"),
91
+ " stylesheet-node ":doc(" /db/regression-test/stylesheet1 .xsl"),
84
92
" stylesheet-params": map { QName("" ," v"): doc(" /db/regression-test/document .xml") } } ) )?output
85
93
return $result
86
94
};
87
95
96
+ declare
97
+ %test:assertEquals(" <v>Gambardella, MatthewXML Developer's GuideComputer44.952000-10-01An in-depth look at creating applications
98
+ with XML.Ralls, KimMidnight RainFantasy5.952000-12-16A former architect battles corporate zombies,
99
+ an evil sorceress, and her own childhood to become queen
100
+ of the world.</v>")
101
+ function testTransform:regression-test-2() {
102
+ let $in := parse-xml("<dummy/>")
103
+ let $result := ( fn:transform(map{
104
+ "source-node":$in,
105
+ "stylesheet-node":doc("/db/regression-test/stylesheet2.xsl"),
106
+ "initial-template": QName('' , ' named-template'),
107
+ "global-context-item" : fn:doc("/db/regression-test/document.xml"),
108
+ "stylesheet-params": map {
109
+ QName('' , ' v'): fn:doc("/db/regression-test/document.xml")
110
+ }}))?output
111
+ return $result
112
+ };
113
+
114
+
0 commit comments