@@ -61,6 +61,18 @@ declare %private function ser:adaptive-map-params($data) {
61
61
ser:adaptive-map-params ($data, ())
62
62
};
63
63
64
+ declare %private function ser:serialize-with-item-separator ($data as item ()*, $method as xs:string) {
65
+ let $options :=
66
+ <output:serialization-parameters
67
+ xmlns:output = "http://www.w3.org/2010/xslt-xquery-serialization" >
68
+ <output:method value = "{$method} " />
69
+ <output:indent>no</output:indent>
70
+ <output:item-separator>--</output:item-separator>
71
+ </output:serialization-parameters>
72
+ return
73
+ fn:serialize ($data, $options)
74
+ };
75
+
64
76
declare variable $ser:atomic :=
65
77
<atomic:root xmlns:atomic = "http://www.w3.org/XQueryTest" xmlns:foo = "http://www.example.com/foo"
66
78
xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" >
@@ -754,4 +766,83 @@ declare
754
766
function ser:exist-process-xsl-pi-false () {
755
767
let $doc := doc ($ser:collection || "/test-xsl.xml" )
756
768
return fn:serialize ($doc, map {xs:QName ("exist:process-xsl-pi" ): false ()})
757
- };
769
+ };
770
+
771
+ declare
772
+ %test:assertEquals("1--2" )
773
+ function ser:item-separator-text-method () {
774
+ let $data := (1 , 2 )
775
+ return ser:serialize-with-item-separator ($data, "text" )
776
+ };
777
+
778
+ declare
779
+ %test:assertEquals("1--2" )
780
+ function ser:item-separator-html-method () {
781
+ let $data := (1 , 2 )
782
+ return ser:serialize-with-item-separator ($data, "html" )
783
+ };
784
+
785
+ declare
786
+ %test:assertEquals("1--2" )
787
+ function ser:item-separator-xhtml-method () {
788
+ let $data := (1 , 2 )
789
+ return ser:serialize-with-item-separator ($data, "xhtml" )
790
+ };
791
+
792
+ declare
793
+ %test:assertEquals("1--2" )
794
+ function ser:item-separator-xml-method () {
795
+ let $data := (1 , 2 )
796
+ return ser:serialize-with-item-separator ($data, "xml" )
797
+ };
798
+
799
+ declare
800
+ %test:assertEquals("1--2" )
801
+ function ser:item-separator-adaptive-method () {
802
+ let $data := (1 , 2 )
803
+ return ser:serialize-with-item-separator ($data, "adaptive" )
804
+ };
805
+
806
+ declare
807
+ %test:assertEquals("1|2|3|4|5|6|7|8|9|10" )
808
+ function ser:serialize-xml-033 () {
809
+ let $params :=
810
+ <output:serialization-parameters xmlns:output = "http://www.w3.org/2010/xslt-xquery-serialization" >
811
+ <output:method value = "xml" />
812
+ <output:item-separator value = "|" />
813
+ </output:serialization-parameters>
814
+ return serialize (1 to 10 , $params)
815
+ };
816
+
817
+ declare
818
+ %test:assertEquals("1==2==3==4" )
819
+ function ser:serialize-xml-034 () {
820
+ let $params :=
821
+ <output:serialization-parameters xmlns:output = "http://www.w3.org/2010/xslt-xquery-serialization" >
822
+ <output:method value = "xml" />
823
+ <output:omit-xml-declaration value = "yes" />
824
+ <output:item-separator value = "==" />
825
+ </output:serialization-parameters>
826
+ return serialize (1 to 4 , $params)
827
+ };
828
+
829
+ declare
830
+ %test:assertEquals("1|2|3|4|5|6|7|8|9|10" )
831
+ function ser:serialize-xml-133 () {
832
+ let $params := map {
833
+ "method" : "xml" ,
834
+ "item-separator" : "|"
835
+ }
836
+ return serialize (1 to 10 , $params)
837
+ };
838
+
839
+ declare
840
+ %test:assertEquals("1==2==3==4" )
841
+ function ser:serialize-xml-134 () {
842
+ let $params := map {
843
+ "method" : "xml" ,
844
+ "omit-xml-declaration" : true (),
845
+ "item-separator" : "=="
846
+ }
847
+ return serialize ((1 to 4 )!text {.}, $params)
848
+ };
0 commit comments