├── .project ├── README.md ├── specs ├── README.md ├── archive │ ├── Makefile │ ├── diff │ │ ├── archive-expanded-diff-20131205.xml │ │ └── archive-expanded-diff.xml │ ├── html │ │ ├── archive-20130930.html │ │ ├── archive-20140512-diff.html │ │ ├── archive-20140512.html │ │ ├── archive-diff.html │ │ └── archive.html │ ├── index.html │ ├── make.bsh │ ├── makeDiff.bsh │ ├── src │ │ ├── 20130930 │ │ │ ├── archive-expanded.xml │ │ │ ├── archive.xml │ │ │ └── function-catalog.xml │ │ ├── 20131205 │ │ │ ├── archive-expanded.xml │ │ │ └── archive.xml │ │ ├── archive-diff.xml │ │ ├── archive-expanded.xml │ │ ├── archive.xml │ │ └── function-catalog.xml │ └── style │ │ ├── funcproto.xsl │ │ ├── merge-function-specs.xsl │ │ ├── xmlspec2html.xsl │ │ └── xmlspecDIFF2html.xsl ├── binary │ ├── Makefile │ ├── diff │ │ ├── binary-expanded-diff-1.0.xml │ │ ├── binary-expanded-diff-20130920.xml │ │ ├── binary-expanded-diff-20131113.xml │ │ ├── binary-expanded-diff-20131125.xml │ │ ├── binary-expanded-diff.xml │ │ └── binary-expanded-diffOLD.xml │ ├── html │ │ ├── binary-1.0-diff.html │ │ ├── binary-1.0.html │ │ ├── binary-20130312.html │ │ ├── binary-20130731.html │ │ ├── binary-20130920-diff.html │ │ ├── binary-20130920.html │ │ ├── binary-20131113-diff.html │ │ ├── binary-20131113.html │ │ ├── binary-20131125-diff.html │ │ ├── binary-20131125.html │ │ ├── binary-diff.html │ │ └── binary.html │ ├── index.html │ ├── make.bat │ ├── make.bsh │ ├── makeDiff.bsh │ ├── src │ │ ├── 20130312 │ │ │ └── binary-expanded.xml │ │ ├── 20130731 │ │ │ ├── binary-expanded.xml │ │ │ ├── binary.xml │ │ │ └── function-catalog.xml │ │ ├── 20130920 │ │ │ ├── binary-expanded-diff.xml │ │ │ ├── binary-expanded.xml │ │ │ ├── binary.xml │ │ │ └── function-catalog.xml │ │ ├── 20131113 │ │ │ ├── binary-expanded.xml │ │ │ ├── binary.xml │ │ │ └── function-catalog.xml │ │ ├── 20131125 │ │ │ ├── binary-expanded.xml │ │ │ ├── binary.xml │ │ │ └── function-catalog.xml │ │ ├── 1.0 │ │ │ ├── binary-expanded.xml │ │ │ ├── binary.xml │ │ │ └── function-catalog.xml │ │ ├── analyze-string.xsd │ │ ├── binary-expanded.xml │ │ ├── binary.xml │ │ ├── fos.xsd │ │ ├── function-catalog.xml │ │ └── xml.xsd │ └── style │ │ ├── funcproto.xsl │ │ ├── merge-function-specs.xsl │ │ ├── xmlspec2html.xsl │ │ └── xmlspecDIFF2html.xsl ├── crypto │ ├── .gitignore │ ├── Makefile │ ├── crypto-20110810.html │ ├── crypto-20110810.xml │ ├── crypto-20150214.html │ ├── crypto-20150214.xml │ ├── crypto-20170320.html │ ├── crypto-20170320.xml │ ├── crypto.html │ ├── crypto.xml │ ├── diff │ │ ├── crypto-20150214-diff.html │ │ └── crypto-20150214-diff.xml │ ├── index.html │ └── pom.xml ├── facet │ ├── .gitignore │ ├── facet-20151225.html │ ├── facet-20151225.md │ ├── facet-20151225.xml │ ├── facet.html │ ├── facet.md │ ├── facet.xml │ ├── index.html │ └── make.sh ├── file │ ├── Makefile │ ├── file-1.0-diff.html │ ├── file-1.0-diff.xml │ ├── file-1.0.html │ ├── file-1.0.xml │ ├── file-20100517.html │ ├── file-20100517.xml │ ├── file-20120614-diff.html │ ├── file-20120614-diff.xml │ ├── file-20120614.html │ ├── file-20120614.xml │ ├── file-20131203-diff.html │ ├── file-20131203-diff.xml │ ├── file-20131203.html │ ├── file-20131203.xml │ ├── file-diff.html │ ├── file-diff.xml │ ├── file.html │ ├── file.xml │ ├── gen-function-catalog.xsl │ ├── index.html │ └── src │ │ ├── ROLWfunction-catalog.xml │ │ └── function-catalog.xml ├── houtil │ ├── src │ │ └── function-catalog.xml │ ├── test-driver │ │ └── xslt │ │ │ ├── assert.xsl │ │ │ ├── compare.xsl │ │ │ ├── report.xml │ │ │ └── run-tests.xsl │ ├── tests │ │ ├── after-first.xml │ │ ├── before-first.xml │ │ ├── catalog.xml │ │ ├── docs │ │ │ ├── filter003.xml │ │ │ ├── filter005.xml │ │ │ ├── filter012.xml │ │ │ ├── group001.xml │ │ │ └── group005.xml │ │ ├── from-first.xml │ │ ├── group-adjacent.xml │ │ ├── group-by-position.xml │ │ ├── group-by.xml │ │ ├── group-starting-with.xml │ │ ├── highest.xml │ │ ├── index-of.xml │ │ ├── lowest.xml │ │ ├── process-groups.xml │ │ └── to-first.xml │ └── xslt-lib │ │ └── houtil-functions.xsl ├── http-client-2 │ └── index.html ├── http-client │ └── index.html ├── http │ ├── Makefile │ ├── http.html │ ├── http.xml │ └── index.html ├── list.xml ├── mongo │ ├── create-html.bat │ ├── html │ │ ├── mongo-20150305.html │ │ └── mongo.html │ ├── index.html │ └── xml │ │ ├── expathspec.rnc │ │ ├── mongo-20150305.xml │ │ └── mongo.xml ├── pkg │ ├── .gitignore │ ├── Makefile │ ├── index.html │ ├── pkg-20090901.html │ ├── pkg-20090901.xml │ ├── pkg-20091118.html │ ├── pkg-20091118.xml │ ├── pkg-20100107-diff.html │ ├── pkg-20100107-diff.xml │ ├── pkg-20100107.html │ ├── pkg-20100107.xml │ ├── pkg-20101111-diff.html │ ├── pkg-20101111-diff.xml │ ├── pkg-20101111.html │ ├── pkg-20101111.xml │ ├── pkg-20120509-diff.html │ ├── pkg-20120509-diff.xml │ ├── pkg-20120509.html │ ├── pkg-20120509.xml │ ├── pkg-diff.xml │ ├── pkg.xml │ └── schema │ │ ├── exist-pkg.rnc │ │ ├── exist-pkg.rng │ │ ├── exist-pkg.xsd │ │ ├── expath-pkg.rnc │ │ ├── expath-pkg.rng │ │ ├── expath-pkg.xsd │ │ ├── packages.rnc │ │ ├── packages.rng │ │ ├── packages.xsd │ │ ├── saxon-pkg.rnc │ │ ├── saxon-pkg.rng │ │ └── saxon-pkg.xsd ├── webapp │ ├── Makefile │ ├── index.html │ ├── schema │ │ └── webapp.xsd │ ├── webapp-20130401.html │ ├── webapp-20130401.xml │ ├── webapp.html │ └── webapp.xml └── xparse │ ├── html │ └── xparse.html │ ├── index.html │ ├── make.bat │ ├── make.bsh │ ├── makeDiff.bsh │ ├── src │ ├── fos.xsd │ ├── function-catalog.xml │ ├── xml.xsd │ ├── xparse-expanded.xml │ └── xparse.xml │ └── style │ ├── funcproto.xsl │ ├── merge-function-specs.xsl │ ├── xmlspec2html.xsl │ └── xmlspecDIFF2html.xsl ├── tests └── qt3 │ ├── .gitignore │ ├── archive │ ├── archive-definition.xml │ ├── archive.xml │ ├── maps │ │ ├── entries.xml │ │ ├── extraction.xml │ │ ├── options.xml │ │ └── updating.xml │ ├── parts │ │ ├── entries.xml │ │ ├── extraction.xml │ │ ├── options.xml │ │ └── updating.xml │ └── sandpit2 │ │ ├── test1.zip │ │ ├── test3.zip │ │ ├── textA.txt │ │ ├── textB.txt │ │ └── textC.txt │ ├── binary │ ├── binary-definition.xml │ ├── binary.xml │ ├── binary2.xml │ └── parts │ │ ├── basic-operations.xml │ │ ├── bitwise.xml │ │ ├── numeric-packing.xml │ │ └── text-encoding.xml │ ├── catalog-schema.xsd │ ├── catalog.xml │ ├── file │ ├── file.xml │ └── sandpit │ │ ├── .gitignore │ │ ├── my file.txt │ │ ├── target.txt │ │ ├── test.txt │ │ ├── test2.txt │ │ ├── test3.txt │ │ └── test4.txt │ ├── mongodb │ ├── .gitignore │ ├── catalog.xml │ ├── mongodb-aggregate.xml │ ├── mongodb-close.xml │ ├── mongodb-command.xml │ ├── mongodb-connect.xml │ ├── mongodb-count.xml │ ├── mongodb-drop-database.xml │ ├── mongodb-errors.xml │ ├── mongodb-eval.xml │ ├── mongodb-find-and-modify.xml │ ├── mongodb-find-and-remove.xml │ ├── mongodb-find-one.xml │ ├── mongodb-find.xml │ ├── mongodb-group.xml │ ├── mongodb-insert.xml │ ├── mongodb-list-collections.xml │ ├── mongodb-list-databases.xml │ ├── mongodb-map-reduce.xml │ ├── mongodb-save.xml │ └── mongodb-update.xml │ └── results │ ├── exceptions.xml │ ├── results_XPath3.0_9.7.0.1.xml │ └── results_XQuery3.0_9.6.0.1.xml └── tools ├── README.md ├── expathspec ├── .gitignore ├── src │ ├── diffspec.xsl │ ├── shared.xsl │ ├── xmlspec.rnc │ └── xmlspec.xsl └── xproject │ ├── cxan.xml │ └── project.xml ├── expathtest ├── README.md └── test-expand.xsl ├── fos └── src │ ├── analyze-string.xsd │ ├── fos.xsd │ └── xml.xsd └── xmlspec ├── .gitignore ├── src ├── base.css ├── diffspec.xsl ├── xmlspec.dtd ├── xmlspec.rnc ├── xmlspec.rng ├── xmlspec.xsd └── xmlspec.xsl └── xproject ├── cxan.xml └── project.xml /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | expath-cg 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | expath-cg 2 | ========= 3 | 4 | Repository for the [W3C EXPath Community Group](http://w3.org/community/expath/). 5 | 6 | The sources of the specifications are in `specs/`, the test suites in 7 | `tests/`, and `tools/` contains various tools, like the schemas for 8 | the test suites and the schemas and stylesheets for the specification 9 | document type. 10 | -------------------------------------------------------------------------------- /specs/README.md: -------------------------------------------------------------------------------- 1 | Specifications 2 | ============== 3 | 4 | This directory contains the sources of all the specifications published by the 5 | [W3C EXPath Community Group](http://w3.org/community/expath/). For now, it 6 | contains: 7 | 8 | * [archive](archive) -- the Archive module 9 | * binary -- the Binary module 10 | * crypto -- the Cryptographic module 11 | * facet -- the Facet module 12 | * file -- the File module 13 | * http -- the HTTP Model 14 | * mongo -- the MongoDB module 15 | * pkg -- the Packaging System 16 | * webapp -- the Web Applications specification 17 | * xparse -- the XParse module 18 | 19 | TODO: Create a checklist when adding a new module (for the specs, the 20 | website, etc.), and a checklist when publishing a new draft (write an 21 | announce, a news entry, add to specs/list.xml, etc.) Sketch below, to 22 | improve... 23 | 24 | Add a new spec 25 | -------------- 26 | 27 | Simple answer: copy a simple one, like the HTTP Model, or `http` spec, 28 | and adapt it to your needs. You can find more details on the wiki, on 29 | the following pages: 30 | 31 | - [Process](https://www.w3.org/community/expath/wiki/Process) 32 | - [Naming](https://www.w3.org/community/expath/wiki/Naming) 33 | - [Tests](https://www.w3.org/community/expath/wiki/Tests) 34 | - [Editors](https://www.w3.org/community/expath/wiki/Editors) 35 | 36 | **Checklist**: 37 | 38 | - ... 39 | - update the [Modules](https://www.w3.org/community/expath/wiki/Modules) page on the wiki 40 | 41 | Publish a new version 42 | --------------------- 43 | 44 | It is possible to an editor to edit a spec and create a pull request. 45 | The current state of a spec is available as an *editor draft*, at a 46 | URL ending with `/editor`, e.g. http://expath.org/spec/http/editor. 47 | 48 | In order to publish a new version, either a dated working draft or a 49 | final 1.0 report, you need to update `list.xml`. Please ask Florent 50 | first, if this is the first time you do it. 51 | 52 | **Checklist**: 53 | 54 | - ... 55 | - update the [Modules](https://www.w3.org/community/expath/wiki/Modules) page on the wiki 56 | -------------------------------------------------------------------------------- /specs/archive/Makefile: -------------------------------------------------------------------------------- 1 | html/archive.html: src/archive-expanded.xml 2 | saxon -s:"$<" -xsl:style/xmlspec2html.xsl > "$@" 3 | 4 | src/archive-expanded.xml: src/archive.xml 5 | saxon -s:"$<" -xsl:style/merge-function-specs.xsl > "$@" 6 | -------------------------------------------------------------------------------- /specs/archive/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /specs/archive/make.bsh: -------------------------------------------------------------------------------- 1 | #! bash 2 | sSrc="C:\Users\jwl\Desktop\SaxonicaWS\Saxon95" 3 | name="archive" 4 | java="java -classpath $sSrc/lib/*;$sSrc/*" 5 | echo $java 6 | saxon="$java -Xms64m -Xmx512m net.sf.saxon.Transform" 7 | $saxon -xsl:style/merge-function-specs.xsl -s:src/$name.xml -o:src/$name-expanded.xml 8 | $saxon -xsl:style/xmlspec2html.xsl -s:src/$name-expanded.xml -o:html/$name.html 9 | 10 | #$saxon -xsl:tools/doc/genSaxonDoc.xsl -s:doc/functions-$name.xml -o:doc/functions-$name-expanded.xml 11 | echo FINISHED 12 | read PAUSE -------------------------------------------------------------------------------- /specs/archive/makeDiff.bsh: -------------------------------------------------------------------------------- 1 | #! bash 2 | sSrc="C:/Users/jwl/Desktop/SaxonicaWS/Saxon95" 3 | java="java -classpath $sSrc/lib/*;$sSrc/*" 4 | echo $java 5 | saxon="$java -Xms64m -Xmx512m net.sf.saxon.Transform" 6 | $saxon -xsl:style/xmlspecDIFF2html.xsl -s:diff/archive-expanded-diff.xml -o:html/archive-diff.html 7 | echo FINISHED 8 | read PAUSE -------------------------------------------------------------------------------- /specs/archive/style/xmlspec2html.xsl: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /specs/archive/style/xmlspecDIFF2html.xsl: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /specs/binary/Makefile: -------------------------------------------------------------------------------- 1 | html/binary.html: src/binary-expanded.xml 2 | saxon -xsl:style/xmlspec2html.xsl -s:"$<" > "$@" 3 | 4 | src/binary-expanded.xml: src/binary.xml 5 | saxon -xsl:style/merge-function-specs.xsl -s:"$<" > "$@" 6 | 7 | html/binary-diff.html: diff/binary-expanded-diff.xml 8 | saxon -xsl:style/xmlspecDIFF2html.xsl -s:"$<" > "$@" 9 | -------------------------------------------------------------------------------- /specs/binary/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /specs/binary/make.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set EXPATH_REPO=c:\expath 3 | call c:\expath-repo\bin\saxon.bat -xsl:style\merge-function-specs.xsl -s:src\binary.xml -o:src\binary-expanded.xml 4 | call c:\expath-repo\bin\saxon.bat -xsl:style\xmlspec2html.xsl -s:src/binary-expanded.xml -o:html/binary.html 5 | 6 | -------------------------------------------------------------------------------- /specs/binary/make.bsh: -------------------------------------------------------------------------------- 1 | #! bash 2 | sSrc="C:/Users/jwl/Desktop/SaxonicaWS/Saxon95" 3 | java="java -classpath $sSrc/lib/*;$sSrc/*" 4 | echo $java 5 | saxon="$java -Xms64m -Xmx512m net.sf.saxon.Transform" 6 | $saxon -xsl:style/merge-function-specs.xsl -s:src/binary.xml -o:src/binary-expanded.xml 7 | #$saxon -xsl:style/merge-function-specs.xsl -s:src/20130731/binary.xml -o:src/20130731/binary-expanded.xml 8 | $saxon -xsl:style/xmlspec2html.xsl -s:src/binary-expanded.xml -o:html/binary.html 9 | 10 | $saxon -xsl:tools/doc/genSaxonDoc.xsl -s:doc/functions-binary.xml -o:doc/functions-binary-expanded.xml 11 | echo FINISHED 12 | read PAUSE -------------------------------------------------------------------------------- /specs/binary/makeDiff.bsh: -------------------------------------------------------------------------------- 1 | #! bash 2 | sSrc="C:/Users/jwl/Desktop/SaxonicaWS/Saxon95" 3 | java="java -classpath $sSrc/lib/*;$sSrc/*" 4 | echo $java 5 | saxon="$java -Xms64m -Xmx512m net.sf.saxon.Transform" 6 | $saxon -xsl:style/xmlspecDIFF2html.xsl -s:diff/binary-expanded-diff.xml -o:html/binary-diff.html 7 | echo FINISHED 8 | read PAUSE -------------------------------------------------------------------------------- /specs/binary/src/analyze-string.xsd: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /specs/binary/src/xml.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /specs/binary/style/xmlspec2html.xsl: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /specs/binary/style/xmlspecDIFF2html.xsl: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /specs/crypto/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /specs/crypto/Makefile: -------------------------------------------------------------------------------- 1 | # If your EXPath repository contains both packages in ../../tools/ 2 | # (that is, xmlspec and expathspec), all you have to do to format the 3 | # spec is (resp. for regular and diff versions): 4 | # 5 | # saxon -s:xxx.xml -xsl:http://expath.org/ns/xmlspec/xmlspec.xsl 6 | # saxon -s:xxx.xml -xsl:http://expath.org/ns/xmlspec/diffspec.xsl 7 | 8 | #XMLSPEC=http://expath.org/ns/xmlspec/xmlspec.xsl 9 | #DIFFSPEC=http://expath.org/ns/xmlspec/diffspec.xsl 10 | XMLSPEC=../../tools/expathspec/src/xmlspec.xsl 11 | DIFFSPEC=../../tools/expathspec/src/diffspec.xsl 12 | 13 | #editorial: crypto.html crypto-diff.html 14 | editorial: crypto.html 15 | 16 | crypto.html: crypto.xml 17 | saxon -s:$< -xsl:$(XMLSPEC) > $@ 18 | 19 | crypto-diff.html: crypto-diff.xml 20 | saxon -s:$< -xsl:$(DIFFSPEC) > $@ 21 | 22 | crypto-20170320.html: crypto-20170320.xml 23 | saxon -s:$< -xsl:$(XMLSPEC) > $@ 24 | 25 | crypto-20170320-diff.html: crypto-20170320-diff.xml 26 | saxon -s:$< -xsl:$(DIFFSPEC) > $@ 27 | 28 | # crypto-20110810.html: crypto-20110810.xml 29 | # saxon -s:$< -xsl:$(XMLSPEC) > $@ 30 | -------------------------------------------------------------------------------- /specs/crypto/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /specs/crypto/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 4.0.0 7 | 8 | org.expath.specs 9 | crypto 10 | 1.0 11 | Specification for EXPath Cryptographic Module 12 | pom 13 | http://expath.org/spec/crypto 14 | 15 | 16 | crypto 17 | Library for EXPath Cryptographic Module 18 | 0.2.5 19 | 20 | 21 | 22 | 23 | 24 | ro.kuberam.maven.plugins 25 | kuberam-expath-plugin 26 | 0.5.9 27 | 28 | 29 | generate-first-spec 30 | prepare-package 31 | 32 | transform-spec-to-html 33 | 34 | 35 | ${basedir}/${project.artifactId}.xml 36 | ${basedir} 37 | UA-43293529-1 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /specs/facet/.gitignore: -------------------------------------------------------------------------------- 1 | _src/ 2 | -------------------------------------------------------------------------------- /specs/facet/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /specs/facet/make.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | jing="java -jar ../../../../jing-20091111/bin/jing.jar" 6 | saxon="java -jar ../../../../SaxonHE9-5-1-6J/saxon9he.jar" 7 | 8 | # To convert md to xml: install https://nodejs.org/, then "npm install markedtoc" 9 | mtoc -x facet.md > facet.xml 10 | 11 | # Using https://github.com/relaxng/jing-trang for xml schema validation 12 | $jing -c ../../tools/xmlspec/src/xmlspec.rnc facet.xml 13 | 14 | # convert xml to html 15 | $saxon -s:facet.xml -xsl:../../tools/expathspec/src/xmlspec.xsl -o:facet.html 16 | 17 | -------------------------------------------------------------------------------- /specs/file/Makefile: -------------------------------------------------------------------------------- 1 | # If your EXPath repository contains both packages in ../../tools/ 2 | # (that is, xmlspec and expathspec), all you have to do to format the 3 | # spec is (resp. for regular and diff versions): 4 | # 5 | # saxon -s:xxx.xml -xsl:http://expath.org/ns/xmlspec/xmlspec.xsl 6 | # saxon -s:xxx.xml -xsl:http://expath.org/ns/xmlspec/diffspec.xsl 7 | 8 | #XMLSPEC=http://expath.org/ns/xmlspec/xmlspec.xsl 9 | #DIFFSPEC=http://expath.org/ns/xmlspec/diffspec.xsl 10 | XMLSPEC=../../tools/expathspec/src/xmlspec.xsl 11 | DIFFSPEC=../../tools/expathspec/src/diffspec.xsl 12 | SAXON=saxon 13 | 14 | latest: file-1.0.html file-1.0-diff.html 15 | 16 | file.html: file.xml 17 | $(SAXON) -s:$< -xsl:$(XMLSPEC) > $@ 18 | 19 | file-diff.html: file-diff.xml 20 | $(SAXON) -s:$< -xsl:$(DIFFSPEC) > $@ 21 | 22 | file-20100517.html: file-20100517.xml 23 | $(SAXON) -s:$< -xsl:$(XMLSPEC) > $@ 24 | 25 | file-20100517-diff.html: file-20100517-diff.xml 26 | $(SAXON) -s:$< -xsl:$(DIFFSPEC) > $@ 27 | 28 | file-20120614.html: file-20120614.xml 29 | $(SAXON) -s:$< -xsl:$(XMLSPEC) > $@ 30 | 31 | file-20120614-diff.html: file-20120614-diff.xml 32 | $(SAXON) -s:$< -xsl:$(DIFFSPEC) > $@ 33 | 34 | file-20131203.html: file-20131203.xml 35 | $(SAXON) -s:$< -xsl:$(XMLSPEC) > $@ 36 | 37 | file-20131203-diff.html: file-20131203-diff.xml 38 | $(SAXON) -s:$< -xsl:$(DIFFSPEC) > $@ 39 | 40 | file-1.0.html: file-1.0.xml 41 | $(SAXON) -s:$< -xsl:$(XMLSPEC) > $@ 42 | 43 | file-1.0-diff.html: file-1.0-diff.xml 44 | $(SAXON) -s:$< -xsl:$(DIFFSPEC) > $@ 45 | -------------------------------------------------------------------------------- /specs/file/gen-function-catalog.xsl: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 |

This stylesheet attempts to extract a function catalog from a specification

10 |
11 | 12 | 13 | 14 | 15 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 |
75 | -------------------------------------------------------------------------------- /specs/file/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /specs/houtil/test-driver/xslt/compare.xsl: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | FIRST: name: {name(.)} local: {local-name(.)}: uri: {namespace-uri(.)} 89 | SECOND: name: {name($b)} local: {local-name($b)}: uri: {namespace-uri($b)} 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | E 127 | A 128 | T 129 | D 130 | C 131 | P 132 | N 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | something 173 | something else 174 | 175 | 176 | 177 | 178 | 179 | 180 | something 181 | something else 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | -------------------------------------------------------------------------------- /specs/houtil/test-driver/xslt/report.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /specs/houtil/tests/catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /specs/houtil/tests/docs/filter003.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /specs/houtil/tests/docs/filter005.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /specs/houtil/tests/docs/filter012.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Text 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /specs/houtil/tests/docs/group001.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /specs/houtil/tests/docs/group005.xml: -------------------------------------------------------------------------------- 1 | 2 |

heading1

3 |

para1

4 |

para2

5 |

heading2

6 |

para3

7 |

para4

8 |

para5

9 | -------------------------------------------------------------------------------- /specs/houtil/tests/highest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | Tests for the array:head function introduced in XPath 3.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Integer with highest square 14 | 15 | 16 | houtil:highest(-5 to +3, function($i){$i*$i}) 17 | 18 | -5 19 | 20 | 21 | 22 | 23 | Empty sequence 24 | 25 | 26 | houtil:highest((1 to 100)[. = year-from-date(current-date())], function($i){$i*$i}) 27 | 28 | 29 | 30 | 31 | 32 | 33 | Longest string 34 | 35 | 36 | houtil:highest(("red", "orange", "yellow", "green", "blue", "indigo", "violet"), string-length#1) 37 | 38 | "orange", "yellow", "indigo", "violet" 39 | 40 | 41 | 42 | 43 | Last in alphabetic order 44 | 45 | 46 | houtil:highest(doc(static-base-uri())//*:test-case, function($t){string($t/@name)})/*:description 47 | 48 | "Function throws an error" 49 | 50 | 51 | 52 | 53 | Function may return empty sequence 54 | 55 | 56 | houtil:highest(-5 to +10, function($i){if ($i lt 0) then $i*$i else ()}) 57 | 58 | -5 59 | 60 | 61 | 62 | 63 | Mix numbers with untyped atomic 64 | 65 | 66 | houtil:highest(-5 to +10, function($i){if ($i lt 0) then $i*$i else xs:untypedAtomic($i*$i)}) 67 | 68 | 10 69 | 70 | 71 | 72 | 73 | Items with key:NaN are ignored 74 | 75 | 76 | houtil:highest((-5 to +10, "nanana"), function($i){number($i)}) 77 | 78 | 10 79 | 80 | 81 | 82 | 83 | Binary data types are now ordered 84 | 85 | 86 | houtil:highest(("1a", "0100", "fd", "F1", "dd"), function($i){xs:hexBinary($i)}) 87 | 88 | "fd" 89 | 90 | 91 | 92 | 93 | Function returns a node (this is atomized by virtue of function coercion) 94 | 95 | 96 | "||$i||"
")})]]> 97 | 98 | 12 99 | 100 | 101 | 102 | 103 | Longest duration 104 | 105 | 106 | houtil:highest(doc(static-base-uri())//*:test-case, function($t){current-date() - xs:date($t/*:created/@on)})/*:description 107 | 108 | "Empty sequence" 109 | 110 | 111 | 112 | 113 | Non-codepoint collation 114 | 115 | 116 | 117 | 118 | 119 | houtil:highest(("a", "A", "z", "Z"), string#1) 120 | 121 | "z", "Z" 122 | 123 | 124 | 125 | 126 | Value of unordered type 127 | 128 | 129 | houtil:highest((QName("http://www.w3.org/", "defined"), QName("http://www.w3.org/", "undefined")), function($i){$i}) 130 | 131 | 132 | 133 | 134 | 135 | 136 | Singleton value of unordered type 137 | 138 | 139 | houtil:highest(QName("http://www.w3.org/", "undefined"), function($i){$i}) 140 | 141 | 142 | 143 | 144 | 145 | 146 | Non-comparable values returned by function 147 | 148 | 149 | houtil:highest(-5 to +3, function($i){if ($i lt 0) then $i else string($i)}) 150 | 151 | 152 | 153 | 154 | 155 | 156 | Function throws an error 157 | 158 | 159 | houtil:highest(-5 to +3, function($i){10 div $i}) 160 | 161 | 162 | 163 | 164 | 165 | 166 | -------------------------------------------------------------------------------- /specs/houtil/tests/lowest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | Tests for the EXPath houtil:lowest function 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Integer with lowest square 14 | 15 | 16 | houtil:lowest(-5 to +3, function($i){$i*$i}) 17 | 18 | 0 19 | 20 | 21 | 22 | 23 | Empty sequence 24 | 25 | 26 | houtil:lowest((1 to 100)[. = year-from-date(current-date())], function($i){$i*$i}) 27 | 28 | 29 | 30 | 31 | 32 | 33 | Shortest string 34 | 35 | 36 | houtil:lowest(("red", "orange", "yellow", "green", "blue", "indigo", "violet"), string-length#1) 37 | 38 | "red" 39 | 40 | 41 | 42 | 43 | First in alphabetic order 44 | 45 | 46 | houtil:lowest(doc(static-base-uri())//*:test-case, function($t){string($t/@name)})/*:description 47 | 48 | "Integer with lowest square" 49 | 50 | 51 | 52 | 53 | Function may return empty sequence 54 | 55 | 56 | houtil:lowest(-5 to +10, function($i){if ($i lt 0) then $i*$i else ()}) 57 | 58 | -1 59 | 60 | 61 | 62 | 63 | Mix numbers with untyped atomic 64 | 65 | 66 | houtil:lowest(-5 to +10, function($i){if ($i lt 0) then $i*$i else xs:untypedAtomic($i*$i)}) 67 | 68 | 0 69 | 70 | 71 | 72 | 73 | Items with key:NaN are ignored 74 | 75 | 76 | houtil:lowest((-5 to +10, "nanana"), function($i){number($i)}) 77 | 78 | -5 79 | 80 | 81 | 82 | 83 | Binary data types are now ordered 84 | 85 | 86 | houtil:lowest(("1a", "0100", "fd", "F1", "dd"), function($i){xs:hexBinary($i)}) 87 | 88 | "0100" 89 | 90 | 91 | 92 | 93 | Function returns a node (this is atomized by virtue of function coercion) 94 | 95 | 96 | "||$i||"")})]]> 97 | 98 | 3 99 | 100 | 101 | 102 | 103 | Earliest date 104 | 105 | 106 | houtil:lowest(doc(static-base-uri())//*:test-case, function($t){xs:date($t/*:created/@on)})/*:description 107 | 108 | "Empty sequence" 109 | 110 | 111 | 112 | 113 | Non-codepoint collation 114 | 115 | 116 | 117 | 118 | 119 | houtil:highest(("a", "A", "z", "Z"), string#1) 120 | 121 | "a", "A" 122 | 123 | 124 | 125 | 126 | Value of unordered type 127 | 128 | 129 | houtil:lowest((QName("http://www.w3.org/", "defined"), QName("http://www.w3.org/", "undefined")), function($i){$i}) 130 | 131 | 132 | 133 | 134 | 135 | 136 | Singleton value of unordered type 137 | 138 | 139 | houtil:lowest(QName("http://www.w3.org/", "undefined"), function($i){$i}) 140 | 141 | 142 | 143 | 144 | 145 | 146 | Non-comparable values returned by function 147 | 148 | 149 | houtil:lowest(-5 to +3, function($i){if ($i lt 0) then $i else string($i)}) 150 | 151 | 152 | 153 | 154 | 155 | 156 | Function throws an error 157 | 158 | 159 | houtil:lowest(-5 to +3, function($i){10 div $i}) 160 | 161 | 162 | 163 | 164 | 165 | 166 | -------------------------------------------------------------------------------- /specs/http/Makefile: -------------------------------------------------------------------------------- 1 | # If your EXPath repository contains both packages in ../../tools/ 2 | # (that is, xmlspec and expathspec), all you have to do to format the 3 | # spec is (resp. for regular and diff versions): 4 | # 5 | # saxon -s:xxx.xml -xsl:http://expath.org/ns/xmlspec/xmlspec.xsl 6 | # saxon -s:xxx.xml -xsl:http://expath.org/ns/xmlspec/diffspec.xsl 7 | 8 | #XMLSPEC=http://expath.org/ns/xmlspec/xmlspec.xsl 9 | #DIFFSPEC=http://expath.org/ns/xmlspec/diffspec.xsl 10 | XMLSPEC=../../tools/expathspec/src/xmlspec.xsl 11 | DIFFSPEC=../../tools/expathspec/src/diffspec.xsl 12 | 13 | #editorial: http.html http-diff.html 14 | editorial: http.html 15 | 16 | http.html: http.xml 17 | saxon -s:$< -xsl:$(XMLSPEC) > $@ 18 | 19 | http-diff.html: http-diff.xml 20 | saxon -s:$< -xsl:$(DIFFSPEC) > $@ 21 | 22 | http-20140228.html: http-20140228.xml 23 | saxon -s:$< -xsl:$(XMLSPEC) > $@ 24 | 25 | http-20140228-diff.html: http-20140228-diff.xml 26 | saxon -s:$< -xsl:$(DIFFSPEC) > $@ 27 | -------------------------------------------------------------------------------- /specs/http/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /specs/mongo/create-html.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set SAXON=java -jar "c:\Program Files (x86)\Saxon\saxon9he.jar" 3 | %SAXON% -s:xml/mongodb.xml -xsl:../../tools/expathspec/src/xmlspec.xsl >html/mongodb.html 4 | rem %SAXON% -s:xml/mongodb-diff.xml -xsl:../../tools/expathspec/src/diffspec.xsl >file-diff.html 5 | -------------------------------------------------------------------------------- /specs/mongo/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /specs/mongo/xml/expathspec.rnc: -------------------------------------------------------------------------------- 1 | namespace ex = "http://expath.org/ns/xmlspec" 2 | 3 | include "http://w3.org/2002/xmlspec/xmlspec.rnc" 4 | 5 | local.spec.att |= 6 | attribute ex:w3c { xsd:boolean } 7 | 8 | eg.pcd.mix |= 9 | element ex:function { text } 10 | | element ex:type { text } 11 | -------------------------------------------------------------------------------- /specs/pkg/.gitignore: -------------------------------------------------------------------------------- 1 | pkg.html 2 | pkg-diff.html 3 | -------------------------------------------------------------------------------- /specs/pkg/Makefile: -------------------------------------------------------------------------------- 1 | # If your EXPath repository contains both packages in ../../tools/ 2 | # (that is, xmlspec and expathspec), all you have to do to format the 3 | # spec is (resp. for regular and diff versions): 4 | # 5 | # saxon -s:xxx.xml -xsl:http://expath.org/ns/xmlspec/xmlspec.xsl 6 | # saxon -s:xxx.xml -xsl:http://expath.org/ns/xmlspec/diffspec.xsl 7 | # 8 | # The Packaging System spec require XInclude. 9 | 10 | XMLSPEC=http://expath.org/ns/xmlspec/xmlspec.xsl 11 | DIFFSPEC=http://expath.org/ns/xmlspec/diffspec.xsl 12 | 13 | editorial: pkg.html pkg-diff.html 14 | 15 | pkg.html: pkg.xml 16 | saxon -xi -s:$< -xsl:$(XMLSPEC) > $@ 17 | 18 | pkg-diff.html: pkg-diff.xml 19 | saxon -xi -s:$< -xsl:$(DIFFSPEC) > $@ 20 | 21 | pkg-20120509.html: pkg-20120509.xml 22 | saxon -xi -s:$< -xsl:$(XMLSPEC) > $@ 23 | 24 | pkg-20120509-diff.html: pkg-20120509-diff.xml 25 | saxon -xi -s:$< -xsl:$(DIFFSPEC) > $@ 26 | -------------------------------------------------------------------------------- /specs/pkg/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /specs/pkg/schema/exist-pkg.rnc: -------------------------------------------------------------------------------- 1 | default namespace = "http://expath.org/ns/pkg" 2 | namespace ns1 = "http://expath.org/ns/pkg/exist" 3 | 4 | start = 5 | (notAllowed 6 | | element ns1:package { 7 | element ns1:xquery { query-type }+ 8 | }) 9 | | dependency 10 | | (notAllowed 11 | | element package { 12 | attribute spec { "1.0-alpha1" }, 13 | attribute version { xsd:string }, 14 | attribute abbrev { xsd:string }, 15 | attribute name { xsd:anyURI }, 16 | element title { xsd:string }, 17 | dependency*, 18 | (element xquery { query-type } 19 | | element xslt { component-type } 20 | | element xproc { component-type } 21 | | element xsd { component-type } 22 | | element rng { component-type } 23 | | element rnc { component-type })* 24 | }) 25 | anyURI = xsd:anyURI 26 | component-type = 27 | ((notAllowed 28 | | element import-uri { anyURI }), 29 | (notAllowed 30 | | element file { anyURI })), 31 | empty 32 | query-type = 33 | ((notAllowed 34 | | element namespace { anyURI }), 35 | (notAllowed 36 | | element file { anyURI })), 37 | empty 38 | dependency = 39 | notAllowed 40 | | element dependency { 41 | attribute semver-max { xsd:token }?, 42 | attribute semver-min { xsd:token }?, 43 | attribute semver { xsd:token }?, 44 | attribute versions { 45 | list { xsd:token* } 46 | }?, 47 | attribute version { xsd:token }?, 48 | attribute name { xsd:anyURI }? 49 | } 50 | -------------------------------------------------------------------------------- /specs/pkg/schema/exist-pkg.rng: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | package 21 | 22 | 1.0-alpha1 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | title 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | xquery 44 | 45 | 46 | 47 | xslt 48 | 49 | 50 | 51 | xproc 52 | 53 | 54 | 55 | xsd 56 | 57 | 58 | 59 | rng 60 | 61 | 62 | 63 | rnc 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | import-uri 81 | 82 | 83 | 84 | 85 | 86 | 87 | file 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | namespace 100 | 101 | 102 | 103 | 104 | 105 | 106 | file 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | dependency 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | -------------------------------------------------------------------------------- /specs/pkg/schema/exist-pkg.xsd: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /specs/pkg/schema/expath-pkg.rnc: -------------------------------------------------------------------------------- 1 | default namespace = "http://expath.org/ns/pkg" 2 | 3 | start = 4 | dependency 5 | | (notAllowed 6 | | element package { 7 | attribute spec { "1.0" }, 8 | attribute version { xsd:string }, 9 | attribute abbrev { xsd:NCName }, 10 | attribute name { xsd:anyURI }, 11 | element title { xsd:string }, 12 | element home { xsd:anyURI }?, 13 | dependency*, 14 | (element xquery { 15 | (element namespace { xsd:anyURI } 16 | | element import-uri { xsd:anyURI }), 17 | element file { xsd:anyURI } 18 | } 19 | | element dtd { 20 | element public-id { xsd:anyURI }?, 21 | element system-id { xsd:anyURI }, 22 | element file { xsd:anyURI } 23 | } 24 | | element resource { 25 | element public-uri { xsd:anyURI }, 26 | element file { xsd:anyURI } 27 | } 28 | | element xslt { component-type } 29 | | element xproc { component-type } 30 | | element xsd { component-type } 31 | | element rng { component-type } 32 | | element rnc { component-type } 33 | | element schematron { component-type } 34 | | element nvdl { component-type })* 35 | }) 36 | dependency = 37 | notAllowed 38 | | element dependency { 39 | attribute semver-max { xsd:token }?, 40 | attribute semver-min { xsd:token }?, 41 | attribute semver { xsd:token }?, 42 | attribute versions { 43 | list { xsd:token* } 44 | }?, 45 | attribute package { xsd:anyURI }?, 46 | attribute processor { xsd:anyURI }? 47 | } 48 | component-type = 49 | ((notAllowed 50 | | element import-uri { xsd:anyURI }), 51 | (notAllowed 52 | | element file { xsd:anyURI })), 53 | empty 54 | -------------------------------------------------------------------------------- /specs/pkg/schema/expath-pkg.rng: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 1.0 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | -------------------------------------------------------------------------------- /specs/pkg/schema/expath-pkg.xsd: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /specs/pkg/schema/packages.rnc: -------------------------------------------------------------------------------- 1 | default namespace = "http://expath.org/ns/repo/packages" 2 | 3 | start = 4 | (notAllowed 5 | | element packages { package* }) 6 | | package 7 | package = 8 | notAllowed 9 | | element package { 10 | attribute version { xsd:string }, 11 | attribute dir { xsd:string }, 12 | attribute name { xsd:anyURI } 13 | } 14 | -------------------------------------------------------------------------------- /specs/pkg/schema/packages.rng: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /specs/pkg/schema/packages.xsd: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /specs/pkg/schema/saxon-pkg.rnc: -------------------------------------------------------------------------------- 1 | default namespace = "http://expath.org/ns/pkg" 2 | namespace ns1 = "http://expath.org/ns/pkg/saxon" 3 | 4 | start = 5 | (notAllowed 6 | | element ns1:package { 7 | element ns1:jar { anyURI }*, 8 | element ns1:function { \string }*, 9 | element ns1:library { \string }*, 10 | element ns1:xslt { component-type }*, 11 | element ns1:xquery { query-type }*, 12 | element ns1:xslt-wrapper { component-type }*, 13 | element ns1:xquery-wrapper { query-type }*, 14 | element ns1:dep { 15 | attribute type { "jar" }?, 16 | element ns1:title { title-type }, 17 | element ns1:home { anyURI }, 18 | (element ns1:href { anyURI } 19 | | element ns1:file { anyURI })? 20 | }* 21 | }) 22 | | dependency 23 | | (notAllowed 24 | | element package { 25 | attribute spec { "1.0-alpha1" }, 26 | attribute version { xsd:string }, 27 | attribute abbrev { xsd:string }, 28 | attribute name { xsd:anyURI }, 29 | element title { title-type }, 30 | dependency*, 31 | (element xquery { query-type } 32 | | element xslt { component-type } 33 | | element xproc { component-type } 34 | | element xsd { component-type } 35 | | element rng { component-type } 36 | | element rnc { component-type })* 37 | }) 38 | anyURI = xsd:anyURI 39 | component-type = 40 | ((notAllowed 41 | | element import-uri { anyURI }), 42 | (notAllowed 43 | | element file { anyURI })), 44 | empty 45 | \string = xsd:string 46 | title-type = xsd:string 47 | query-type = 48 | ((notAllowed 49 | | element namespace { anyURI }), 50 | (notAllowed 51 | | element file { anyURI })), 52 | empty 53 | dependency = 54 | notAllowed 55 | | element dependency { 56 | attribute semver-max { xsd:token }?, 57 | attribute semver-min { xsd:token }?, 58 | attribute semver { xsd:token }?, 59 | attribute versions { 60 | list { xsd:token* } 61 | }?, 62 | attribute version { xsd:token }?, 63 | attribute name { xsd:anyURI }? 64 | } 65 | -------------------------------------------------------------------------------- /specs/pkg/schema/saxon-pkg.rng: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | jar 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | package 76 | 77 | 1.0-alpha1 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | title 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | xquery 99 | 100 | 101 | 102 | xslt 103 | 104 | 105 | 106 | xproc 107 | 108 | 109 | 110 | xsd 111 | 112 | 113 | 114 | rng 115 | 116 | 117 | 118 | rnc 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | import-uri 136 | 137 | 138 | 139 | 140 | 141 | 142 | file 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | namespace 161 | 162 | 163 | 164 | 165 | 166 | 167 | file 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | dependency 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | -------------------------------------------------------------------------------- /specs/pkg/schema/saxon-pkg.xsd: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /specs/webapp/Makefile: -------------------------------------------------------------------------------- 1 | # If your EXPath repository contains both packages from ../../tools/ 2 | # (that is, xmlspec and expathspec), all you have to do to format the 3 | # spec is (resp. for regular and diff versions): 4 | # 5 | # saxon -s:xxx.xml -xsl:http://expath.org/ns/xmlspec/xmlspec.xsl 6 | # saxon -s:xxx.xml -xsl:http://expath.org/ns/xmlspec/diffspec.xsl 7 | # 8 | # The Packaging System spec require XInclude. 9 | 10 | XMLSPEC=http://expath.org/ns/xmlspec/xmlspec.xsl 11 | DIFFSPEC=http://expath.org/ns/xmlspec/diffspec.xsl 12 | LATEST=20130319 13 | 14 | editor: webapp.html 15 | latest: webapp-$(LATEST).html webapp-$(LATEST)-diff.html 16 | 17 | webapp.html: webapp.xml 18 | saxon -xi -s:$< -xsl:$(XMLSPEC) > $@ 19 | 20 | webapp-diff.html: webapp-diff.xml 21 | saxon -xi -s:$< -xsl:$(DIFFSPEC) > $@ 22 | 23 | webapp-$(LATEST).html: webapp-$(LATEST).xml 24 | saxon -xi -s:$< -xsl:$(XMLSPEC) > $@ 25 | 26 | webapp-$(LATEST)-diff.html: webapp-$(LATEST)-diff.xml 27 | saxon -xi -s:$< -xsl:$(DIFFSPEC) > $@ 28 | -------------------------------------------------------------------------------- /specs/webapp/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /specs/xparse/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /specs/xparse/make.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set EXPATH_REPO=c:\expath 3 | call c:\expath-repo\bin\saxon.bat -xsl:style\merge-function-specs.xsl -s:src\binary.xml -o:src\binary-expanded.xml 4 | call c:\expath-repo\bin\saxon.bat -xsl:style\xmlspec2html.xsl -s:src/binary-expanded.xml -o:html/binary.html 5 | 6 | -------------------------------------------------------------------------------- /specs/xparse/make.bsh: -------------------------------------------------------------------------------- 1 | #! bash 2 | sSrc="C:/Users/jwl/Desktop/SaxonicaWS/Saxon95" 3 | java="java -classpath $sSrc/lib/*;$sSrc/*" 4 | echo $java 5 | saxon="$java -Xms64m -Xmx512m net.sf.saxon.Transform" 6 | $saxon -xsl:style/merge-function-specs.xsl -s:src/xparse.xml -o:src/xparse-expanded.xml 7 | #$saxon -xsl:style/merge-function-specs.xsl -s:src/20130731/binary.xml -o:src/20130731/binary-expanded.xml 8 | $saxon -xsl:style/xmlspec2html.xsl -s:src/xparse-expanded.xml -o:html/xparse.html 9 | 10 | #$saxon -xsl:tools/doc/genSaxonDoc.xsl -s:doc/functions-binary.xml -o:doc/functions-binary-expanded.xml 11 | echo FINISHED 12 | read PAUSE -------------------------------------------------------------------------------- /specs/xparse/makeDiff.bsh: -------------------------------------------------------------------------------- 1 | #! bash 2 | sSrc="C:/Users/jwl/Desktop/SaxonicaWS/Saxon95" 3 | java="java -classpath $sSrc/lib/*;$sSrc/*" 4 | echo $java 5 | saxon="$java -Xms64m -Xmx512m net.sf.saxon.Transform" 6 | $saxon -xsl:style/xmlspecDIFF2html.xsl -s:diff/binary-expanded-diff.xml -o:html/binary-diff.html 7 | echo FINISHED 8 | read PAUSE -------------------------------------------------------------------------------- /specs/xparse/src/function-catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |

The xp:parse function returns a parse tree for an expression.

24 |
25 | 26 |

Returns a parse-tree for the XPath/XQuery expression given in $in.

27 |

$options is a map of control options as described in .

29 |

In the absence of any options, the default values are used.

30 |
31 | 32 |

is raised if $in cannot be parsed 33 | successfully against the given grammar. It is implementation (and language) dependent as to 34 | what and how further information is made available about this failure.

35 |

is raised if one or more of the option values within 36 | $options is invalid or unrecognised.

37 |
38 | 39 |

Some notes

40 |
41 | 42 | 43 |

Parsing a simple range expression, with options to flatten single trees and remove 44 | unnecessary tokens:

45 | 47 | 48 | 49 | 50 | ]]> 51 |
52 |
53 |
54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 |

The xp:to-expression function returns an expression tree corresponding to a 68 | given parse tree.

69 |
70 | 71 |

Returns a string for the XPath/XQuery expression tree given in $in.

72 |

$options is a map of control options as described in .

74 |

In the absence of any options, the default values are used.

75 |
76 | 77 |

is raised if $in is not a valid expression 78 | tree, or suitable reduced subtree, for the grammar requested. It is implementation (and 79 | language) dependent as to what and how further information is made available about this 80 | failure.

81 |

is raised if one or more of the option values within 82 | $options is invalid or unrecognised.

83 |
84 | 85 |

Some notes

86 |
87 | 88 | 89 |

Testing whether $data variable starts with binary content consistent with a 90 | PDF file:

91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | ==> "4 - 2 to 8"]]> 102 |
103 |
104 |
105 |
106 | -------------------------------------------------------------------------------- /specs/xparse/src/xml.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /specs/xparse/style/xmlspec2html.xsl: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /specs/xparse/style/xmlspecDIFF2html.xsl: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /tests/qt3/.gitignore: -------------------------------------------------------------------------------- 1 | sandpit -------------------------------------------------------------------------------- /tests/qt3/archive/archive-definition.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | Tests for the extension functions in the EXPath "archive" package. Note the tests 5 | are written on the assumption that the "working directory" for resolving relative filenames 6 | is the directory containing this test catalog file. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 45 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /tests/qt3/archive/maps/entries.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | Tests for the extension functions in the EXPath "archive" package. Note the tests 5 | are written on the assumption that the "working directory" for resolving relative filenames 6 | is the directory containing this test catalog file. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Count entries in a one-entry zip 18 | 19 | arch:entries-map($test1.ZIP) 20 | 21 | 22 | 23 | map(xs:string,map(xs:string,item()*)) 24 | 1 25 | 26 | 27 | 28 | 29 | Count entries in a multi-entry zip 30 | 31 | map:keys(arch:entries-map($test3.ZIP)) 32 | 33 | 34 | 35 | xs:string* 36 | 3 37 | 'textA.txt','textB.txt','textC.txt' 38 | 39 | 40 | 41 | 42 | Size from a map 43 | 44 | arch:entries-map($test3.ZIP)('textA.txt')('size') 45 | 46 | 47 | 48 | xs:integer 49 | 14 50 | 51 | 52 | 53 | 54 | Required properties set 55 | 56 | map:keys(arch:entries-map($test3.ZIP)('textA.txt')) 57 | 58 | 59 | 60 | xs:string* 61 | 'position','size','compressed-size','last-modified','compression' 62 | 63 | 64 | 65 | 66 | Required properties set - with content 67 | 68 | map:keys(arch:entries-map($test3.ZIP,true())('textA.txt')) 69 | 70 | 71 | 72 | xs:string* 73 | 'position','content','size','compressed-size','last-modified','compression' 74 | 75 | 76 | 77 | 78 | Type of content 79 | 80 | arch:entries-map($test3.ZIP,true())('textA.txt')('content') 81 | 82 | 83 | 84 | xs:base64Binary 85 | 1 86 | 87 | 88 | 89 | 90 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /tests/qt3/archive/maps/extraction.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | Tests for the extension functions in the EXPath "archive" package. Note the tests 5 | are written on the assumption that the "working directory" for resolving relative filenames 6 | is the directory containing this test catalog file. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Unknown entry 18 | 19 | arch:extract-binary-map($test1.ZIP,$unknown.test1) 20 | 21 | 22 | 23 | 24 | 25 | 26 | Known entry 27 | 28 | arch:extract-binary-map($test1.ZIP,$known.test1) 29 | 30 | 31 | 32 | xs:base64Binary 33 | 1 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | Unknown entry 46 | 47 | arch:extract-text-map($test1.ZIP,$unknown.test1) 48 | 49 | 50 | 51 | 52 | 53 | 54 | Checking default coding, and lower/upper case 55 | 56 | arch:extract-text-map($test1.ZIP,$known.test1) 57 | = arch:extract-text-map($test1.ZIP,$known.test1,'UTF-8') and 58 | arch:extract-text-map($test1.ZIP,$known.test1) 59 | = arch:extract-text-map($test1.ZIP,$known.test1,'utf-8') 60 | 61 | 62 | 63 | 64 | 65 | 66 | Checking unknown coding 67 | 68 | arch:extract-text-map($test1.ZIP,$known.test1,'NOT-UTF-8') 69 | 70 | 71 | 72 | 73 | 74 | 75 | Checking with known coding 76 | 77 | arch:extract-text-map($test1.ZIP,$known.test1) 78 | 79 | 80 | 81 | xs:string 82 | 'Some text here' 83 | 84 | 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /tests/qt3/archive/maps/options.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | Tests for the extension functions in the EXPath "archive" package. Note the tests 5 | are written on the assumption that the "working directory" for resolving relative filenames 6 | is the directory containing this test catalog file. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Options for a ZIP file 18 | 19 | arch:options-map($test1.ZIP) 20 | 21 | 22 | 23 | map(xs:string,item()*) 24 | 1 25 | 26 | 27 | 28 | 29 | Required properties set 30 | 31 | map:keys(arch:options-map($test3.ZIP)) 32 | 33 | 34 | 35 | xs:string* 36 | 'format','compression' 37 | 38 | 39 | 40 | 41 | Format for a ZIP file 42 | 43 | arch:options-map($test1.ZIP)('format') 44 | 45 | 46 | 'zip' 47 | 48 | 49 | 50 | compression for a ZIP file 51 | 52 | arch:options-map($test1.ZIP)('compression') 53 | 54 | 55 | 'stored' 56 | 57 | 58 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /tests/qt3/archive/maps/updating.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | Tests for the extension functions in the EXPath "archive" package. Note the tests 5 | are written on the assumption that the "working directory" for resolving relative filenames 6 | is the directory containing this test catalog file. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Delete entry from a one-entry zip 18 | 19 | arch:delete-map(arch:create-map($simple.Text.map),map:entry('simple.Text',())) 20 | 21 | 22 | 23 | xs:base64Binary 24 | 1 25 | 26 | 27 | 28 | 29 | Deletion with empty deletion request 30 | 31 | 32 | let $a := arch:create-map($simple.Text.map) 33 | return arch:delete-map($a,map:merge(())) = $a 34 | 35 | 36 | 37 | 38 | 39 | 40 | Delete the only entry from a one-entry zip 41 | 42 | map:keys(arch:entries-map( 43 | arch:delete-map(arch:create-map($simple.Text.map),$simple.Text.map) 44 | )) 45 | 46 | 47 | 48 | 49 | 50 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Update entry in a one-entry zip 76 | 77 | arch:update-map($test1.ZIP,$simple.Text.map) 78 | 79 | 80 | 81 | xs:base64Binary 82 | 1 83 | 84 | 85 | 86 | 87 | Update entry in a one-entry zip - new entry 88 | 89 | map:keys(arch:entries-map(arch:update-map($test1.ZIP,$simple.Text.map))) 90 | 91 | 92 | 93 | xs:string* 94 | 2 95 | ('textA.txt','simple.Text') 96 | 97 | 98 | 99 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | Create a one-entry ZIP 138 | 139 | arch:create-map($simple.Text.map) 140 | 141 | 142 | 143 | xs:base64Binary 144 | 1 145 | 146 | 147 | 148 | 158 | 159 | 160 | 161 | -------------------------------------------------------------------------------- /tests/qt3/archive/parts/entries.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | Tests for the extension functions in the EXPath "archive" package. Note the tests 5 | are written on the assumption that the "working directory" for resolving relative filenames 6 | is the directory containing this test catalog file. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Count entries in a one-entry zip 16 | arch:entries($test1.ZIP) 17 | 18 | 19 | element(arch:entry) 20 | 1 21 | 22 | 23 | 24 | 25 | Count entries in a multi-entry zip 26 | arch:entries($test3.ZIP) 27 | 28 | 29 | element(arch:entry)* 30 | 3 31 | 32 | 33 | 34 | 35 | Entries in a multi-entry zip 36 | for $e in arch:entries($test3.ZIP) return string($e) 37 | 38 | 39 | ('textA.txt','textB.txt','textC.txt') 40 | 41 | 42 | 43 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /tests/qt3/archive/parts/extraction.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | Tests for the extension functions in the EXPath "archive" package. Note the tests 5 | are written on the assumption that the "working directory" for resolving relative filenames 6 | is the directory containing this test catalog file. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Unknown entry 16 | 17 | arch:extract-binary($test1.ZIP,'foo') 18 | 19 | 20 | 21 | 22 | 23 | 24 | Known entry 25 | 26 | arch:extract-binary($test1.ZIP,$textA) 27 | 28 | 29 | 30 | xs:base64Binary 31 | 1 32 | 33 | 34 | 35 | 36 | Known entry - duplication 37 | 38 | arch:extract-binary($test1.ZIP,($textA,$textA)) 39 | 40 | 41 | 42 | xs:base64Binary* 43 | 2 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | Unknown entry 55 | 56 | arch:extract-text($test1.ZIP,'foo') 57 | 58 | 59 | 60 | 61 | 62 | 63 | Checking default coding, and lower/upper case 64 | 65 | arch:extract-text($test1.ZIP,$textA) 66 | = arch:extract-text($test1.ZIP,$textA,'UTF-8') and 67 | arch:extract-text($test1.ZIP,$textA) 68 | = arch:extract-text($test1.ZIP,$textA,'utf-8') 69 | 70 | 71 | 72 | 73 | 74 | 75 | Checking unknown coding 76 | 77 | arch:extract-text($test1.ZIP,$textA,'NOT-UTF-8') 78 | 79 | 80 | 81 | 82 | 83 | 84 | Checking unknown coding 85 | 86 | arch:extract-text($test1.ZIP,$textA) 87 | 88 | 89 | 90 | xs:string 91 | 'Some text here' 92 | 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /tests/qt3/archive/parts/options.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | Tests for the extension functions in the EXPath "archive" package. Note the tests 5 | are written on the assumption that the "working directory" for resolving relative filenames 6 | is the directory containing this test catalog file. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Options for a ZIP file 16 | 17 | arch:options($test1.ZIP) 18 | 19 | 20 | 21 | element(arch:options) 22 | 1 23 | 24 | 25 | 26 | 27 | Format for a ZIP file 28 | 29 | string(arch:options($test1.ZIP)/@format) 30 | 31 | 32 | 'zip' 33 | 34 | 35 | 36 | Compression for a ZIP file 37 | 38 | string(arch:options($test1.ZIP)/@compression) 39 | 40 | 41 | 'unknown' 42 | 43 | 44 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /tests/qt3/archive/parts/updating.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | Tests for the extension functions in the EXPath "archive" package. Note the tests 5 | are written on the assumption that the "working directory" for resolving relative filenames 6 | is the directory containing this test catalog file. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Delete entry from a one-entry zip 16 | 17 | arch:delete($test1.ZIP,($textA)) 18 | 19 | 20 | 21 | xs:base64Binary 22 | 1 23 | 24 | 25 | 26 | 27 | Deletion with empty deletion request 28 | 29 | arch:delete($test1.ZIP,()) = $test1.ZIP 30 | 31 | 32 | 33 | 34 | 35 | 36 | Delete entry from a one-entry zip 37 | 38 | arch:entries(arch:delete($test1.ZIP,($textA))) 39 | 40 | 41 | 42 | 43 | 44 | 45 | Delete unknown entry from a one-entry zip 46 | 47 | arch:delete($test1.ZIP,('textNOTTHERE.txt')) 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Update entry in a one-entry zip 61 | 62 | arch:update($test1.ZIP,$textA,$simple.Text) 63 | 64 | 65 | 66 | xs:base64Binary 67 | 1 68 | 69 | 70 | 71 | 72 | Update entry in a one-entry zip - already there 73 | 74 | for $ e in arch:entries(arch:update($test1.ZIP,$textA,$simple.Text)) 75 | return string($e) 76 | 77 | 78 | ('textA.txt') 79 | 80 | 81 | 82 | Update entry in a one-entry zip - new entry 83 | 84 | arch:update($test1.ZIP,'new.txt',$simple.Text) 85 | 86 | 87 | 88 | xs:base64Binary 89 | 1 90 | 91 | 92 | 93 | 94 | Update entry in a one-entry zip - new entry 95 | 96 | for $ e in arch:entries(arch:update($test1.ZIP,'new.txt',$simple.Text)) 97 | return string($e) 98 | 99 | 100 | ('new.txt','textA.txt') 101 | 102 | 103 | 104 | Update entry in a one-entry zip - new entry 105 | 106 | arch:extract-binary(arch:update($test1.ZIP,'new.txt',$simple.Text),'new.txt') 107 | = $simple.Text 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | Create a one-entry ZIP 121 | 122 | arch:create('new.txt',$simple.Text) 123 | 124 | 125 | 126 | xs:base64Binary 127 | 1 128 | 129 | 130 | 131 | 132 | Create a one-entry ZIP 133 | 134 | arch:extract-binary(arch:create('new.txt',$simple.Text),'new.txt') 135 | = $simple.Text 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | -------------------------------------------------------------------------------- /tests/qt3/archive/sandpit2/test1.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/expath/expath-cg/ef429eafe10a6a0397a14ce2aeaf9542cef3215a/tests/qt3/archive/sandpit2/test1.zip -------------------------------------------------------------------------------- /tests/qt3/archive/sandpit2/test3.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/expath/expath-cg/ef429eafe10a6a0397a14ce2aeaf9542cef3215a/tests/qt3/archive/sandpit2/test3.zip -------------------------------------------------------------------------------- /tests/qt3/archive/sandpit2/textA.txt: -------------------------------------------------------------------------------- 1 | Some text here -------------------------------------------------------------------------------- /tests/qt3/archive/sandpit2/textB.txt: -------------------------------------------------------------------------------- 1 | This is from the file textB -------------------------------------------------------------------------------- /tests/qt3/archive/sandpit2/textC.txt: -------------------------------------------------------------------------------- 1 | More textual data - this time from the file textC 2 | which extends over more than one line -------------------------------------------------------------------------------- /tests/qt3/catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /tests/qt3/file/sandpit/.gitignore: -------------------------------------------------------------------------------- 1 | dir* -------------------------------------------------------------------------------- /tests/qt3/file/sandpit/my file.txt: -------------------------------------------------------------------------------- 1 | abc -------------------------------------------------------------------------------- /tests/qt3/file/sandpit/target.txt: -------------------------------------------------------------------------------- 1 | treaty -------------------------------------------------------------------------------- /tests/qt3/file/sandpit/test.txt: -------------------------------------------------------------------------------- 1 | abc -------------------------------------------------------------------------------- /tests/qt3/file/sandpit/test2.txt: -------------------------------------------------------------------------------- 1 | abc£ -------------------------------------------------------------------------------- /tests/qt3/file/sandpit/test3.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/expath/expath-cg/ef429eafe10a6a0397a14ce2aeaf9542cef3215a/tests/qt3/file/sandpit/test3.txt -------------------------------------------------------------------------------- /tests/qt3/file/sandpit/test4.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/expath/expath-cg/ef429eafe10a6a0397a14ce2aeaf9542cef3215a/tests/qt3/file/sandpit/test4.txt -------------------------------------------------------------------------------- /tests/qt3/mongodb/.gitignore: -------------------------------------------------------------------------------- 1 | impl* -------------------------------------------------------------------------------- /tests/qt3/mongodb/catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tests/qt3/mongodb/mongodb-aggregate.xml: -------------------------------------------------------------------------------- 1 | 2 | Tests for the extension functions in the EXPath "mongodb" package. 3 | 4 | 5 | 6 | 7 | Tests a simple aggregation. 8 | 9 | 10 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 11 | 12 | let $id := mongodb:connect("localhost") 13 | return ( 14 | mongodb:drop-database($id, 'expath'), 15 | 16 | mongodb:insert($id, 'expath', 'coll', map { "dep": "A", "sum": 71, "type": "a" }), 17 | mongodb:insert($id, 'expath', 'coll', map { "dep": "B", "sum": 15, "type": "a" }), 18 | mongodb:insert($id, 'expath', 'coll', map { "dep": "C", "sum": 5, "type": "a" }), 19 | mongodb:insert($id, 'expath', 'coll', map { "dep": "A", "sum": 77, "type": "a" }), 20 | 21 | mongodb:aggregate($id, 'expath', 'coll', ( 22 | map { "$match" : map { "type": "a" } }, 23 | map { "$project": map { "dep": 1, "sum": 1, "_id": 0 } }, 24 | map { "$group" : map { "_id": "$dep", "avg": map { "$avg": "$sum" } } }, 25 | map { "$sort" : map { "sum" : -1 } }) 26 | ), 27 | 28 | mongodb:drop-database($id, 'expath') 29 | ) 30 | 31 | 32 | 33 | 3 34 | every $avg in $result?avg satisfies $avg = (5, 15, 74) 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /tests/qt3/mongodb/mongodb-close.xml: -------------------------------------------------------------------------------- 1 | 2 | Tests for the extension functions in the EXPath "mongodb" package. 3 | 4 | 5 | 6 | 7 | Closes a connection that has just been opened. 8 | 9 | 10 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 11 | mongodb:close(mongodb:connect("localhost")) 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | Ensures the a connection cannot be closed twice. 20 | 21 | 22 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 23 | let $id := mongodb:connect("localhost") 24 | return ( 25 | mongodb:close($id), 26 | mongodb:close($id) 27 | ) 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /tests/qt3/mongodb/mongodb-command.xml: -------------------------------------------------------------------------------- 1 | 2 | Tests for the extension functions in the EXPath "mongodb" package. 3 | 4 | 5 | 6 | 7 | Performs a ping command 8 | 9 | 10 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 11 | let $id := mongodb:connect("localhost") 12 | return mongodb:command($id, 'expath', map { 'ping': 1 }) 13 | 14 | 15 | count($result?*) = 1 16 | 17 | 18 | 19 | 20 | Performs an invalid command. 21 | 22 | 23 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 24 | let $id := mongodb:connect("localhost") 25 | return mongodb:command($id, 'expath', map { 'invalid': 1 }) 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Performs an invalid command (empty string). 34 | 35 | 36 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 37 | let $id := mongodb:connect("localhost") 38 | return mongodb:command($id, 'expath', map { '': 1 }) 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /tests/qt3/mongodb/mongodb-connect.xml: -------------------------------------------------------------------------------- 1 | 2 | Tests for the extension functions in the EXPath "mongodb" package. 3 | 4 | 5 | 6 | 7 | Ensure that connection ids are different. 8 | 9 | 10 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 11 | let $id1 := mongodb:connect("localhost") 12 | let $id2 := mongodb:connect("mongodb://localhost") 13 | return $id1 ne $id2 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | Ensures that the id of a closed url will not be assigned again. 22 | 23 | 24 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 25 | let $id1 := mongodb:connect("localhost") 26 | let $id2 := ( 27 | mongodb:close($id1), 28 | mongodb:connect("localhost") 29 | ) 30 | return $id1 ne $id2 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | Tries to connect to an invalid URL. 39 | 40 | 41 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 42 | mongodb:connect("localhost:a") 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | Tries to connect to an invalid URL. 51 | 52 | 53 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 54 | mongodb:connect("http://xxx:888") 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /tests/qt3/mongodb/mongodb-count.xml: -------------------------------------------------------------------------------- 1 | 2 | Tests for the extension functions in the EXPath "mongodb" package. 3 | 4 | 5 | 6 | 7 | Simple count. 8 | 9 | 10 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 11 | 12 | let $id := mongodb:connect("localhost") 13 | return ( 14 | mongodb:drop-database($id, 'expath'), 15 | 16 | for $i in (1 to 10) 17 | return ( 18 | mongodb:insert($id, 'expath', 'coll', 19 | map { 'x': $i, 'y': $i, 'z': $i * $i }), 20 | mongodb:insert($id, 'expath', 'coll', 21 | map { 'x': $i, 'y': (10 - $i), 'z': $i * $i }) 22 | ), 23 | mongodb:count($id, 'expath', 'coll'), 24 | 25 | mongodb:drop-database($id, 'expath') 26 | ) 27 | 28 | 29 | 20 30 | 31 | 32 | 33 | 34 | Count with query argument. 35 | 36 | 37 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 38 | 39 | let $id := mongodb:connect("localhost") 40 | return ( 41 | mongodb:drop-database($id, 'expath'), 42 | 43 | for $i in (1 to 10) 44 | return ( 45 | mongodb:insert($id, 'expath', 'coll', 46 | map { 'x': $i, 'y': $i, 'z': $i * $i }), 47 | mongodb:insert($id, 'expath', 'coll', 48 | map { 'x': $i, 'y': (10 - $i), 'z': $i * $i }) 49 | ), 50 | mongodb:count($id, 'expath', 'coll', map { 'x': 2 }), 51 | 52 | mongodb:drop-database($id, 'expath') 53 | ) 54 | 55 | 56 | 2 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /tests/qt3/mongodb/mongodb-drop-database.xml: -------------------------------------------------------------------------------- 1 | 2 | Tests for the extension functions in the EXPath "mongodb" package. 3 | 4 | 5 | 6 | 7 | Inserts a test document, drops the database and ensures that it was dropped. 8 | 9 | 10 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 11 | 12 | let $id := mongodb:connect("localhost") 13 | return ( 14 | mongodb:insert($id, 'expath', 'coll', map { "A":"B" }), 15 | mongodb:drop-database($id, 'expath'), 16 | mongodb:list-databases($id) = 'expath' 17 | ) 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /tests/qt3/mongodb/mongodb-errors.xml: -------------------------------------------------------------------------------- 1 | 2 | Tests for the extension functions in the EXPath "mongodb" package. 3 | 4 | 5 | 6 | 7 | Tries to close a non-existing connection. 8 | 9 | 10 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 11 | mongodb:close("invalid") 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | Tries to pass on an empty database name. 20 | 21 | 22 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 23 | let $id := mongodb:connect("localhost") 24 | return mongodb:list-collections($id, "") 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | Passes on a long database name. 33 | 34 | 35 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 36 | let $id := mongodb:connect("localhost") 37 | let $database := string-join((1 to 63) ! 'x') 38 | return ( 39 | mongodb:drop-database($id, $database), 40 | mongodb:list-collections($id, $database) 41 | ) 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | Tries to pass on a too long database name. 50 | 51 | 52 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 53 | let $id := mongodb:connect("localhost") 54 | let $database := string-join((1 to 64) ! 'x') 55 | return mongodb:list-collections($id, $database) 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | Tries to pass on an invalid database name. 64 | 65 | 66 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 67 | let $id := mongodb:connect("localhost") 68 | for $invalid in string-to-codepoints('/\. "$*<>:|?') 69 | return try { 70 | let $database := 'x' || codepoints-to-string($invalid) || 'x' 71 | return mongodb:list-collections($id, $database) 72 | } catch mongodb:name { ((: expected :)) } 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | Tries to pass on an empty collection name. 81 | 82 | 83 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 84 | let $id := mongodb:connect("localhost") 85 | return mongodb:find($id, 'expath', '') 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | Tries to pass on a long collection name. 94 | 95 | 96 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 97 | let $id := mongodb:connect("localhost") 98 | let $collection := string-join((1 to 117) ! 'x') 99 | return ( 100 | mongodb:drop-database($id, 'expath'), 101 | mongodb:find($id, 'expath', $collection) 102 | ) 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | Tries to pass on a too long collection name. 111 | 112 | 113 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 114 | let $id := mongodb:connect("localhost") 115 | let $collection := string-join((1 to 118) ! 'x') 116 | return mongodb:find($id, 'expath', $collection) 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | Tries to pass on an invalid collection name. 125 | 126 | 127 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 128 | let $id := mongodb:connect("localhost") 129 | return mongodb:find($id, 'expath', 'x$x') 130 | 131 | 132 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /tests/qt3/mongodb/mongodb-eval.xml: -------------------------------------------------------------------------------- 1 | 2 | Tests for the extension functions in the EXPath "mongodb" package. 3 | 4 | 5 | 6 | 7 | Tests an empty function. 8 | 9 | 10 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 11 | let $id := mongodb:connect("localhost") 12 | return mongodb:eval($id, 'expath', '123') 13 | 14 | 15 | 123 16 | 17 | 18 | 19 | 20 | Tests eval with number. 21 | 22 | 23 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 24 | let $id := mongodb:connect("localhost") 25 | return mongodb:eval($id, 'expath', 26 | 'function( x, y ) { return x + y; }', 27 | (2, xs:decimal(5))) 28 | 29 | 30 | 31 | xs:double 32 | 7 33 | 34 | 35 | 36 | 37 | 38 | Tests eval with boolean. 39 | 40 | 41 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 42 | let $id := mongodb:connect("localhost") 43 | return mongodb:eval($id, 'expath', 44 | 'function( x ) { return x; }', 45 | true()) 46 | 47 | 48 | 49 | xs:boolean 50 | 51 | 52 | 53 | 54 | 55 | 56 | Tests eval with string. 57 | 58 | 59 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 60 | let $id := mongodb:connect("localhost") 61 | return mongodb:eval($id, 'expath', 62 | 'function( value ) { return value; }', 63 | "test") 64 | 65 | 66 | 67 | xs:string 68 | 'test' 69 | 70 | 71 | 72 | 73 | 74 | Tests eval with node. 75 | 76 | 77 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 78 | let $id := mongodb:connect("localhost") 79 | return mongodb:eval($id, 'expath', 80 | 'function( value ) { return value; }', 81 | element e { 'X' }) 82 | 83 | 84 | 85 | xs:string 86 | 'X' 87 | 88 | 89 | 90 | 91 | 92 | Tests eval with object as parameter and return value. 93 | 94 | 95 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 96 | let $id := mongodb:connect("localhost") 97 | return mongodb:eval($id, 'expath', 98 | 'function($map) { return $map }', 99 | map { 'a': 'b' } 100 | ) 101 | 102 | 103 | 104 | map(*) 105 | deep-equal($result, map { 'a': 'b' }) 106 | 107 | 108 | 109 | 110 | 111 | Tests eval() with array as parameter and return value. 112 | 113 | 114 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 115 | let $id := mongodb:connect("localhost") 116 | return mongodb:eval($id, 'expath', 117 | 'function($map) { return $map }', 118 | array { 'x' } 119 | ) 120 | 121 | 122 | 123 | array(*) 124 | array { 'x' } 125 | 126 | 127 | 128 | 129 | 130 | Tests eval() with function item as parameter. 131 | 132 | 133 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 134 | let $id := mongodb:connect("localhost") 135 | return mongodb:eval($id, 'expath', 136 | 'function($map) { return $map }', 137 | true#0 138 | ) 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | Tests eval() with QName as parameter. 147 | 148 | 149 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 150 | let $id := mongodb:connect("localhost") 151 | return mongodb:eval($id, 'expath', 152 | 'function($map) { return $map }', 153 | xs:QName('a') 154 | ) 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | Tests eval() with erroneous JavaScript function. 163 | 164 | 165 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 166 | let $id := mongodb:connect("localhost") 167 | return mongodb:eval($id, 'expath', 'function() { 1+ }') 168 | 169 | 170 | 171 | 172 | 173 | 174 | -------------------------------------------------------------------------------- /tests/qt3/mongodb/mongodb-find-and-modify.xml: -------------------------------------------------------------------------------- 1 | 2 | Tests for the extension functions in the EXPath "mongodb" package. 3 | 4 | 5 | 6 | 7 | Simple find-and-modify call. 8 | 9 | 10 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 11 | 12 | let $id := mongodb:connect("localhost") 13 | return ( 14 | mongodb:drop-database($id, 'expath'), 15 | 16 | mongodb:insert($id, 'expath', 'coll', map { 'x': 1, 'y': 10, 'z': 100 }), 17 | mongodb:insert($id, 'expath', 'coll', map { 'x': 2, 'y': 10, 'z': 200 }), 18 | mongodb:insert($id, 'expath', 'coll', map { 'x': 3, 'y': 30, 'z': 300 }), 19 | mongodb:insert($id, 'expath', 'coll', map { 'x': 4, 'y': 40, 'z': 300 }), 20 | mongodb:insert($id, 'expath', 'coll', map { 'x': 5, 'y': 50, 'z': 300 }), 21 | mongodb:insert($id, 'expath', 'coll', map { 'x': 6, 'y': 60, 'z': 3000 }), 22 | mongodb:insert($id, 'expath', 'coll', map { 'x': 7, 'y': 70, 'z': 3000 }), 23 | 24 | mongodb:find-and-modify($id, 'expath', 'coll', 25 | map { 'x': 2 }, map { 'x': 2 , 'y': 20 , 'z': 200 }), 26 | mongodb:find-and-modify($id, 'expath', 'coll', 27 | map { 'x': 2 }, map { 'x': 2 , 'y': 30 , 'z': 200 }) 28 | ) 29 | 30 | 31 | 32 | $result[1]?y = 10 33 | $result[2]?y = 20 34 | 35 | 36 | 37 | 38 | 39 | find-and-modify call with sort. 40 | 41 | 42 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 43 | 44 | let $id := mongodb:connect("localhost") 45 | return ( 46 | mongodb:drop-database($id, 'expath'), 47 | 48 | mongodb:insert($id, 'expath', 'coll', map { 'x': 1, 'y': 10, 'z': 100 }), 49 | mongodb:insert($id, 'expath', 'coll', map { 'x': 2, 'y': 10, 'z': 200 }), 50 | mongodb:insert($id, 'expath', 'coll', map { 'x': 3, 'y': 30, 'z': 300 }), 51 | mongodb:insert($id, 'expath', 'coll', map { 'x': 4, 'y': 40, 'z': 300 }), 52 | mongodb:insert($id, 'expath', 'coll', map { 'x': 5, 'y': 50, 'z': 300 }), 53 | mongodb:insert($id, 'expath', 'coll', map { 'x': 6, 'y': 60, 'z': 3000 }), 54 | mongodb:insert($id, 'expath', 'coll', map { 'x': 7, 'y': 70, 'z': 3000 }), 55 | 56 | mongodb:find-and-modify($id, 'expath', 'coll', 57 | map { 'z': 300 }, 58 | map { 'x': 2 , 'y': 20 , 'z': 400 }, 59 | map { 'sort': map { 'y': -1 } } 60 | ), 61 | mongodb:find-and-modify($id, 'expath', 'coll', 62 | map { 'z': 300 }, 63 | map { 'x': 2 , 'y': 30 , 'z': 400 }, 64 | map { 'sort': map { 'y': 1 } } 65 | ) 66 | ) 67 | 68 | 69 | 70 | $result[1]?x = 5 71 | $result[2]?x = 3 72 | 73 | 74 | 75 | 76 | 77 | find-and-modify non-existing document. 78 | 79 | 80 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 81 | 82 | let $id := mongodb:connect("localhost") 83 | return ( 84 | mongodb:drop-database($id, 'expath'), 85 | 86 | mongodb:insert($id, 'expath', 'coll', map { 'x': 1, 'y': 10, 'z': 100 }), 87 | mongodb:insert($id, 'expath', 'coll', map { 'x': 2, 'y': 10, 'z': 200 }), 88 | mongodb:insert($id, 'expath', 'coll', map { 'x': 3, 'y': 30, 'z': 300 }), 89 | mongodb:insert($id, 'expath', 'coll', map { 'x': 4, 'y': 40, 'z': 300 }), 90 | mongodb:insert($id, 'expath', 'coll', map { 'x': 5, 'y': 50, 'z': 300 }), 91 | mongodb:insert($id, 'expath', 'coll', map { 'x': 6, 'y': 60, 'z': 3000 }), 92 | mongodb:insert($id, 'expath', 'coll', map { 'x': 7, 'y': 70, 'z': 3000 }), 93 | 94 | mongodb:find-and-modify($id, 'expath', 'coll', 95 | map { 'unknown': 0 }, 96 | map { 'unknown': 2 } 97 | ) 98 | ) 99 | 100 | 101 | 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /tests/qt3/mongodb/mongodb-find-and-remove.xml: -------------------------------------------------------------------------------- 1 | 2 | Tests for the extension functions in the EXPath "mongodb" package. 3 | 4 | 5 | 6 | 7 | Simple find-and-remove call. 8 | 9 | 10 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 11 | 12 | let $id := mongodb:connect("localhost") 13 | return ( 14 | mongodb:drop-database($id, 'expath'), 15 | 16 | mongodb:insert($id, 'expath', 'coll', ( 17 | map { 'x': 1, 'y': 10, 'z': 100 }, 18 | map { 'x': 2, 'y': 20, 'z': 200 }, 19 | map { 'x': 3, 'y': 20, 'z': 300 }, 20 | map { 'x': 4, 'y': 40, 'z': 300 }, 21 | map { 'x': 5, 'y': 50, 'z': 500 } 22 | )), 23 | 24 | mongodb:find-and-remove($id, 'expath', 'coll', map { 'x': 2 }), 25 | mongodb:find-and-remove($id, 'expath', 'coll', map { 'x': 2 }) 26 | ) 27 | 28 | 29 | 30 | 1 31 | $result[1]?y = 20 32 | 33 | 34 | 35 | 36 | 37 | Find-and-remove call. 38 | 39 | 40 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 41 | 42 | let $id := mongodb:connect("localhost") 43 | return ( 44 | mongodb:drop-database($id, 'expath'), 45 | 46 | mongodb:insert($id, 'expath', 'coll', ( 47 | map { 'x': 1, 'y': 10, 'z': 100 }, 48 | map { 'x': 2, 'y': 20, 'z': 200 }, 49 | map { 'x': 3, 'y': 20, 'z': 300 }, 50 | map { 'x': 4, 'y': 40, 'z': 300 }, 51 | map { 'x': 5, 'y': 50, 'z': 500 } 52 | )), 53 | 54 | mongodb:find-and-remove($id, 'expath', 'coll', map { 'y': 20, 'z': 300 }), 55 | mongodb:find-and-remove($id, 'expath', 'coll', map { 'y': 20, 'z': 300 }) 56 | ) 57 | 58 | 59 | 60 | 1 61 | $result[1]?x = 3 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /tests/qt3/mongodb/mongodb-find-one.xml: -------------------------------------------------------------------------------- 1 | 2 | Tests for the extension functions in the EXPath "mongodb" package. 3 | 4 | 5 | 6 | 7 | Simple find-one call. 8 | 9 | 10 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 11 | 12 | let $id := mongodb:connect("localhost") 13 | return ( 14 | mongodb:drop-database($id, 'expath'), 15 | 16 | for $i in (1 to 10) 17 | return ( 18 | mongodb:insert($id, 'expath', 'coll', map { 'x': $i, 'y': $i, 'z': $i * $i }), 19 | mongodb:insert($id, 'expath', 'coll', map { 'x': $i, 'y': (10 - $i), 'z': $i * $i }) 20 | ), 21 | 22 | mongodb:find-one($id, 'expath', 'coll') 23 | ) 24 | 25 | 26 | 27 | 1 28 | $result?y = 1 29 | 30 | 31 | 32 | 33 | 34 | Simple find-one call with query. 35 | 36 | 37 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 38 | 39 | let $id := mongodb:connect("localhost") 40 | return ( 41 | mongodb:drop-database($id, 'expath'), 42 | 43 | for $i in (1 to 10) 44 | return ( 45 | mongodb:insert($id, 'expath', 'coll', map { 'x': $i, 'y': $i, 'z': $i * $i }), 46 | mongodb:insert($id, 'expath', 'coll', map { 'x': $i, 'y': (10 - $i), 'z': $i * $i }) 47 | ), 48 | 49 | mongodb:find-one($id, 'expath', 'coll', map { 'z': 64 }) 50 | ) 51 | 52 | 53 | 54 | 1 55 | $result?x = 8 56 | 57 | 58 | 59 | 60 | 61 | Simple find-one call with query and field restriction. 62 | 63 | 64 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 65 | 66 | let $id := mongodb:connect("localhost") 67 | return ( 68 | mongodb:drop-database($id, 'expath'), 69 | 70 | for $i in (1 to 10) 71 | return ( 72 | mongodb:insert($id, 'expath', 'coll', map { 'x': $i, 'y': $i, 'z': $i * $i }), 73 | mongodb:insert($id, 'expath', 'coll', map { 'x': $i, 'y': (10 - $i), 'z': $i * $i }) 74 | ), 75 | 76 | mongodb:find-one($id, 'expath', 'coll', 77 | map { 'x': 6 }, map { 'fields': map { 'y': 1 } }) 78 | ) 79 | 80 | 81 | 82 | 1 83 | count($result?x) = 0 84 | count($result?y) = 1 85 | $result?y = 6 86 | 87 | 88 | 89 | 90 | 91 | Simple find-one call with query and sort. 92 | 93 | 94 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 95 | 96 | let $id := mongodb:connect("localhost") 97 | return ( 98 | mongodb:drop-database($id, 'expath'), 99 | 100 | for $i in (1 to 10) 101 | return ( 102 | mongodb:insert($id, 'expath', 'coll', map { 'x': $i, 'y': $i, 'z': $i * $i }), 103 | mongodb:insert($id, 'expath', 'coll', map { 'x': $i, 'y': (10 - $i), 'z': $i * $i }) 104 | ), 105 | 106 | mongodb:find-one($id, 'expath', 'coll', 107 | map { 'z': 49 }, map { 'fields': map { 'x': 1, 'y': 1 } }) 108 | ) 109 | 110 | 111 | 112 | 1 113 | count($result?x) = 1 114 | count($result?y) = 1 115 | $result?x = 7 116 | 117 | 118 | 119 | 120 | 121 | Simple find-one call with query and sort. 122 | 123 | 124 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 125 | 126 | let $id := mongodb:connect("localhost") 127 | return ( 128 | mongodb:drop-database($id, 'expath'), 129 | 130 | for $i in (1 to 10) 131 | return ( 132 | mongodb:insert($id, 'expath', 'coll', map { 'x': $i, 'y': $i, 'z': $i * $i }), 133 | mongodb:insert($id, 'expath', 'coll', map { 'x': $i, 'y': (10 - $i), 'z': $i * $i }) 134 | ), 135 | 136 | let $query := map { 'z': 49 } 137 | let $fields := map { 'x': 1, 'y': 1 } 138 | let $sort := map { 'x': 1 } 139 | return mongodb:find-one($id, 'expath', 'coll', 140 | $query, map { 'fields': $fields, 'sort': $sort }) 141 | ) 142 | 143 | 144 | 145 | $result?x = 7 146 | $result?y = 7 147 | 148 | 149 | 150 | 151 | -------------------------------------------------------------------------------- /tests/qt3/mongodb/mongodb-find.xml: -------------------------------------------------------------------------------- 1 | 2 | Tests for the extension functions in the EXPath "mongodb" package. 3 | 4 | 5 | 6 | 7 | Simple find. 8 | 9 | 10 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 11 | 12 | let $id := mongodb:connect("localhost") 13 | return ( 14 | mongodb:drop-database($id, 'expath'), 15 | 16 | for $i in (1 to 10) 17 | return ( 18 | mongodb:insert($id, 'expath', 'coll', map { 'x': $i, 'y': $i, 'z': ($i * $i) }), 19 | mongodb:insert($id, 'expath', 'coll', map { 'x': $i, 'y': (10 - $i), 'z': ($i * $i) }) 20 | ), 21 | 22 | mongodb:find($id, 'expath', 'coll') 23 | ) 24 | 25 | 26 | 20 27 | 28 | 29 | 30 | 31 | Find with query. 32 | 33 | 34 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 35 | 36 | let $id := mongodb:connect("localhost") 37 | return ( 38 | mongodb:drop-database($id, 'expath'), 39 | 40 | for $i in (1 to 10) 41 | return ( 42 | mongodb:insert($id, 'expath', 'coll', map { 'x': $i, 'y': $i, 'z': ($i * $i) }), 43 | mongodb:insert($id, 'expath', 'coll', map { 'x': $i, 'y': (10 - $i), 'z': ($i * $i) }) 44 | ), 45 | 46 | mongodb:find($id, 'expath', 'coll', map { 'x': 5 }) 47 | ) 48 | 49 | 50 | 2 51 | 52 | 53 | 54 | 55 | Find with query and field restrictions. 56 | 57 | 58 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 59 | 60 | let $id := mongodb:connect("localhost") 61 | return ( 62 | mongodb:drop-database($id, 'expath'), 63 | 64 | for $i in (1 to 10) 65 | return ( 66 | mongodb:insert($id, 'expath', 'coll', map { 'x': $i, 'y': $i, 'z': ($i * $i) }), 67 | mongodb:insert($id, 'expath', 'coll', map { 'x': $i, 'y': (10 - $i), 'z': ($i * $i) }) 68 | ), 69 | 70 | mongodb:find($id, 'expath', 'coll', 71 | map { 'x' : 6 }, 72 | map { 'fields': map { 'y' : 1 } } 73 | ) 74 | ) 75 | 76 | 77 | 78 | 2 79 | count($result?x) = 0 80 | count($result?y) = 2 81 | deep-equal($result?y, (6, 4)) 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /tests/qt3/mongodb/mongodb-group.xml: -------------------------------------------------------------------------------- 1 | 2 | Tests for the extension functions in the EXPath "mongodb" package. 3 | 4 | 5 | 6 | 7 | Simple group call. 8 | 9 | 10 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 11 | 12 | let $id := mongodb:connect("localhost") 13 | return ( 14 | mongodb:drop-database($id, 'expath'), 15 | 16 | mongodb:insert($id, 'expath', 'coll', ( 17 | map { "name": "Jack", "city": "London", "sex": "male", "shoes": 6 }, 18 | map { "name": "John", "city": "London", "sex": "male", "shoes": 12 }, 19 | map { "name": "Lisa", "city": "Berlin", "sex": "female", "shoes": 15 } 20 | )), 21 | 22 | mongodb:group($id, 'expath', 'coll', 23 | map { "city": "London" }, 24 | "function (curr, result) { result.total += curr.shoes; }", 25 | map { "total": 0 }, 26 | map { "cond": map { "sex": "male" } } 27 | ) 28 | ) 29 | 30 | 31 | 32 | 1 33 | $result[1]?total = 18 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /tests/qt3/mongodb/mongodb-insert.xml: -------------------------------------------------------------------------------- 1 | 2 | Tests for the extension functions in the EXPath "mongodb" package. 3 | 4 | 5 | 6 | 7 | Simple insert call. 8 | 9 | 10 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 11 | 12 | let $id := mongodb:connect("localhost") 13 | return ( 14 | mongodb:drop-database($id, 'expath'), 15 | 16 | mongodb:insert($id, 'expath', 'coll', map { 'x': 1, 'y': 2, 'z': 3 }), 17 | mongodb:count($id, 'expath', 'coll') 18 | ) 19 | 20 | 21 | 1 22 | 23 | 24 | 25 | 26 | Simple insert call with two documents. 27 | 28 | 29 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 30 | 31 | let $id := mongodb:connect("localhost") 32 | return ( 33 | mongodb:drop-database($id, 'expath'), 34 | 35 | mongodb:insert($id, 'expath', 'coll', ( 36 | map { 'x': 2, 'y': 1, 'z': 3 }, map { 'x': 2, 'y': 2, 'z': 3 }) 37 | ), 38 | mongodb:count($id, 'expath', 'coll') 39 | ) 40 | 41 | 42 | 2 43 | 44 | 45 | 46 | 47 | Simple insert call with empty sequence. 48 | 49 | 50 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 51 | 52 | let $id := mongodb:connect("localhost") 53 | return ( 54 | mongodb:drop-database($id, 'expath'), 55 | 56 | mongodb:insert($id, 'expath', 'coll', ()), 57 | mongodb:count($id, 'expath', 'coll') 58 | ) 59 | 60 | 61 | 0 62 | 63 | 64 | 65 | 66 | Simple insert call with empty document. 67 | 68 | 69 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 70 | 71 | let $id := mongodb:connect("localhost") 72 | return ( 73 | mongodb:drop-database($id, 'expath'), 74 | 75 | mongodb:insert($id, 'expath', 'coll', map { }), 76 | mongodb:count($id, 'expath', 'coll') 77 | ) 78 | 79 | 80 | 1 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /tests/qt3/mongodb/mongodb-list-collections.xml: -------------------------------------------------------------------------------- 1 | 2 | Tests for the extension functions in the EXPath "mongodb" package. 3 | 4 | 5 | 6 | 7 | Simple list-collections call. 8 | 9 | 10 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 11 | 12 | let $id := mongodb:connect("localhost") 13 | return ( 14 | mongodb:drop-database($id, 'expath'), 15 | 16 | mongodb:insert($id, 'expath', 'coll', map { 'A': 'B' }), 17 | mongodb:list-collections($id, 'expath') 18 | ) 19 | 20 | 21 | $result = 'coll' 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /tests/qt3/mongodb/mongodb-list-databases.xml: -------------------------------------------------------------------------------- 1 | 2 | Tests for the extension functions in the EXPath "mongodb" package. 3 | 4 | 5 | 6 | 7 | Simple list-databases call. 8 | 9 | 10 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 11 | 12 | let $id := mongodb:connect("localhost") 13 | return ( 14 | mongodb:drop-database($id, 'expath'), 15 | 16 | mongodb:insert($id, 'expath', 'coll', map { 'A': 'B' }), 17 | mongodb:list-databases($id) 18 | ) 19 | 20 | 21 | $result = 'expath' 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /tests/qt3/mongodb/mongodb-map-reduce.xml: -------------------------------------------------------------------------------- 1 | 2 | Tests for the extension functions in the EXPath "mongodb" package. 3 | 4 | 5 | 6 | 7 | Simple map-reduce call. 8 | 9 | 10 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 11 | 12 | let $id := mongodb:connect("localhost") 13 | return ( 14 | mongodb:drop-database($id, 'expath'), 15 | 16 | mongodb:insert($id, 'expath', 'coll', ( 17 | map { "cust_id": "A123", "amount": 500, "status": "A" }, 18 | map { "cust_id": "A123", "amount": 250, "status": "A" }, 19 | map { "cust_id": "B212", "amount": 200, "status": "A" }, 20 | map { "cust_id": "A123", "amount": 300, "status": "D" } 21 | )), 22 | 23 | mongodb:map-reduce($id, 'expath', 'coll', 24 | "function() { emit( this.cust_id, this.amount); }", 25 | "function(key, values) { return Array.sum( values ) } ", 26 | map { 'query': map { "status": "A" } } 27 | ) 28 | ) 29 | 30 | 31 | 32 | 2 33 | $result?value = 200 34 | $result?value = 750 35 | 36 | 37 | 38 | 39 | 40 | Simple map-reduce call. 41 | 42 | 43 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 44 | 45 | let $id := mongodb:connect("localhost") 46 | let $new-collection := 'coll-new' 47 | return ( 48 | mongodb:drop-database($id, 'expath'), 49 | 50 | mongodb:insert($id, 'expath', 'coll', ( 51 | map { "cust_id": "A123", "amount": 500, "status": "A" }, 52 | map { "cust_id": "A123", "amount": 250, "status": "A" }, 53 | map { "cust_id": "B212", "amount": 200, "status": "A" }, 54 | map { "cust_id": "A123", "amount": 300, "status": "D" } 55 | )), 56 | 57 | let $result := mongodb:map-reduce($id, 'expath', 'coll', 58 | "function() { emit( this.cust_id, this.amount); }", 59 | "function(key, values) { return Array.sum( values ) } ", 60 | map { 61 | 'query': map { "status": "A" }, 62 | 'out': $new-collection, 63 | 'type': 'REDUCE' 64 | } 65 | ) 66 | return $result[1]?value + $result[2]?value, 67 | 68 | let $result := mongodb:find($id, 'expath', $new-collection) 69 | return $result[1]?value + $result[2]?value 70 | ) 71 | 72 | 73 | 74 | 2 75 | $result[1] = $result[2] 76 | 77 | 78 | 79 | 80 | 81 | map-reduce call with erroneous JavaScript code. 82 | 83 | 84 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 85 | 86 | let $id := mongodb:connect("localhost") 87 | return mongodb:map-reduce($id, 'expath', 'coll', 88 | "function() { bug }", 89 | "function(key, values) { return Array.sum( values ) } ", 90 | map { 'query': map { "status": "A" } } 91 | ) 92 | 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /tests/qt3/mongodb/mongodb-save.xml: -------------------------------------------------------------------------------- 1 | 2 | Tests for the extension functions in the EXPath "mongodb" package. 3 | 4 | 5 | 6 | 7 | Insert three documents. 8 | 9 | 10 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 11 | 12 | let $id := mongodb:connect("localhost") 13 | return ( 14 | mongodb:drop-database($id, 'expath'), 15 | 16 | mongodb:save($id, 'expath', 'coll', map { 'x': 1, 'y': 2, 'z': 3 }), 17 | mongodb:save($id, 'expath', 'coll', map { 'x': 1, 'y': 2, 'z': 3 }), 18 | mongodb:save($id, 'expath', 'coll', map { 'x': 1, 'y': 2, 'z': 3 }), 19 | 20 | mongodb:count($id, 'expath', 'coll') 21 | ) 22 | 23 | 24 | 3 25 | 26 | 27 | 28 | 29 | Insert the same document twice. 30 | 31 | 32 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 33 | 34 | let $id := mongodb:connect("localhost") 35 | return ( 36 | mongodb:drop-database($id, 'expath'), 37 | 38 | mongodb:save($id, 'expath', 'coll', map { '_id': '1', 'x': 2, 'y': 2, 'z': 3 }), 39 | mongodb:save($id, 'expath', 'coll', map { '_id': '1', 'x': 2, 'y': 2, 'z': 3 }), 40 | 41 | mongodb:count($id, 'expath', 'coll') 42 | ) 43 | 44 | 45 | 1 46 | 47 | 48 | 49 | 50 | Insert identical and different documents. 51 | 52 | 53 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 54 | 55 | let $id := mongodb:connect("localhost") 56 | return ( 57 | mongodb:drop-database($id, 'expath'), 58 | 59 | mongodb:save($id, 'expath', 'coll', map { '_id': '1', 'x': 2, 'y': 2, 'z': 3 }), 60 | mongodb:save($id, 'expath', 'coll', map { '_id': '1', 'x': 2, 'y': 2, 'z': 3 }), 61 | mongodb:save($id, 'expath', 'coll', map { 'x': 2, 'y': 2, 'z': 3 }), 62 | 63 | mongodb:count($id, 'expath', 'coll') 64 | ) 65 | 66 | 67 | 2 68 | 69 | 70 | 71 | 72 | Insert empty document. 73 | 74 | 75 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 76 | 77 | let $id := mongodb:connect("localhost") 78 | return ( 79 | mongodb:drop-database($id, 'expath'), 80 | 81 | mongodb:save($id, 'expath', 'coll', map { }), 82 | 83 | mongodb:count($id, 'expath', 'coll') 84 | ) 85 | 86 | 87 | 1 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /tests/qt3/mongodb/mongodb-update.xml: -------------------------------------------------------------------------------- 1 | 2 | Tests for the extension functions in the EXPath "mongodb" package. 3 | 4 | 5 | 6 | 7 | Insert and update document. 8 | 9 | 10 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 11 | 12 | let $id := mongodb:connect("localhost") 13 | return ( 14 | mongodb:drop-database($id, 'expath'), 15 | 16 | mongodb:insert($id, 'expath', 'coll', map { 'x': 1, 'y': 2, 'z': 3 }), 17 | mongodb:update($id, 'expath', 'coll', map { 'x': 1 }, map { '$set': map { 'q': 4 } }), 18 | 19 | mongodb:count($id, 'expath', 'coll', map { 'x': 1 }), 20 | mongodb:count($id, 'expath', 'coll', map { 'q': 4 }) 21 | ) 22 | 23 | 24 | 25 | 2 26 | $result[1] = 1 27 | $result[2] = 1 28 | 29 | 30 | 31 | 32 | 33 | Update non-existing document. 34 | 35 | 36 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 37 | 38 | let $id := mongodb:connect("localhost") 39 | return ( 40 | mongodb:drop-database($id, 'expath'), 41 | 42 | mongodb:update($id, 'expath', 'coll', map { 'x': 2 }, map { 'qa': 4 }), 43 | mongodb:count($id, 'expath', 'coll', map { 'qa': 4 }) 44 | ) 45 | 46 | 47 | 0 48 | 49 | 50 | 51 | 52 | Update non-existing document, with upsert flag. 53 | 54 | 55 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 56 | 57 | let $id := mongodb:connect("localhost") 58 | return ( 59 | mongodb:drop-database($id, 'expath'), 60 | 61 | mongodb:update($id, 'expath', 'coll', 62 | map { 'x': 3 }, map { 'qb': 4 }, 63 | map { 'upsert': true() }), 64 | mongodb:count($id, 'expath', 'coll', map { 'qa': 4 }) 65 | ) 66 | 67 | 68 | 0 69 | 70 | 71 | 72 | 73 | Update two documents with multi flag. 74 | 75 | 76 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 77 | 78 | let $id := mongodb:connect("localhost") 79 | return ( 80 | mongodb:drop-database($id, 'expath'), 81 | 82 | mongodb:insert($id, 'expath', 'coll', map { 'x': 10, 'y': 1, 'z': 3 }), 83 | mongodb:insert($id, 'expath', 'coll', map { 'x': 10, 'y': 2, 'z': 3 }), 84 | mongodb:update($id, 'expath', 'coll', map { 'x': 10 }, 85 | map { '$set': map { 'qc': 4 } }, map { 'multi': true() }), 86 | 87 | mongodb:count($id, 'expath', 'coll', map { 'x': 10 }), 88 | mongodb:count($id, 'expath', 'coll', map { 'qc': 4 }) 89 | ) 90 | 91 | 92 | 93 | $result[1] = 2 94 | $result[2] = 2 95 | 96 | 97 | 98 | 99 | 100 | Update two documents without multi flag. 101 | 102 | 103 | import module namespace mongodb = 'http://expath.org/ns/mongodb'; 104 | 105 | let $id := mongodb:connect("localhost") 106 | return ( 107 | mongodb:drop-database($id, 'expath'), 108 | 109 | mongodb:insert($id, 'expath', 'coll', map { 'x': 20, 'y': 1, 'z': 3 }), 110 | mongodb:insert($id, 'expath', 'coll', map { 'x': 20, 'y': 2, 'z': 3 }), 111 | 112 | mongodb:update($id, 'expath', 'coll', 113 | map { 'x': 20 }, map { '$set': map { 'qd': 4 } }), 114 | 115 | mongodb:count($id, 'expath', 'coll', map { 'x': 20 }), 116 | mongodb:count($id, 'expath', 'coll', map { 'qd': 4 }) 117 | ) 118 | 119 | 120 | 121 | $result[1] = 2 122 | $result[2] = 1 123 | 124 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /tests/qt3/results/exceptions.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/qt3/results/results_XQuery3.0_9.6.0.1.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/expath/expath-cg/ef429eafe10a6a0397a14ce2aeaf9542cef3215a/tests/qt3/results/results_XQuery3.0_9.6.0.1.xml -------------------------------------------------------------------------------- /tools/README.md: -------------------------------------------------------------------------------- 1 | Tools 2 | ===== 3 | 4 | Contains various tools. For now, it contains the W3C XMLSpec (the stylesheets 5 | and schemas), and its extension EXPathSpec, both structured following the 6 | [XProject](http://expath.org/modules/xproject/) conventions in order to 7 | produce XAR files automatically. You can find more informations on XMLSpec at 8 | http://www.w3.org/2002/xmlspec/. 9 | -------------------------------------------------------------------------------- /tools/expathspec/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | -------------------------------------------------------------------------------- /tools/expathspec/src/diffspec.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 11 | 12 | http://expath.org/ns/xmlspec/diffspec.xsl 13 | 14 | 15 | 18 | 19 | 20 | div.diff-add { background-color: #FFFF99; } 21 | div.diff-del { text-decoration: line-through; } 22 | div.diff-chg { background-color: #99FF99; } 23 | div.diff-off { } 24 | 25 | span.diff-add { background-color: #FFFF99; } 26 | span.diff-del { text-decoration: line-through; } 27 | span.diff-chg { background-color: #99FF99; } 28 | span.diff-off { } 29 | 30 | td.diff-add { background-color: #FFFF99; } 31 | td.diff-del { text-decoration: line-through } 32 | td.diff-chg { background-color: #99FF99; } 33 | td.diff-off { } 34 | 35 | 36 | code.function { font-weight: bold; } 37 | code.type { font-style: italic; } body { background-image: url( 38 | 39 | ); } 40 | 41 | 44 | 45 | 46 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 57 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /tools/expathspec/src/shared.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 14 | 15 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 41 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | < 69 | 70 | 71 | 72 | > 73 | 74 | 75 | 76 | 77 | 78 |
79 |
80 | 81 | 82 | 83 | 84 | 85 |
86 | Editor 87 | 88 | s 89 | 90 | : 91 |
92 | 93 | 94 |
95 | Contributor 96 | 97 | s 98 | 99 | : 100 |
101 | 102 |
103 |
104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 132 | 133 | 134 | ( 135 | 136 | ) 137 | 138 | 139 |
140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 |

197 | 198 | 199 | 200 | W3C 202 | 203 | 204 | 205 | 206 | EXPath 208 | 209 | 210 | 211 |

212 | 213 |
214 | 215 | 216 | 217 | 218 | 219 | 220 | 224 | 230 | 231 | 232 | 233 |
234 | -------------------------------------------------------------------------------- /tools/expathspec/src/xmlspec.rnc: -------------------------------------------------------------------------------- 1 | namespace ex = "http://expath.org/ns/xmlspec" 2 | 3 | include "http://w3.org/2002/xmlspec/xmlspec.rnc" 4 | 5 | local.spec.att |= 6 | attribute ex:w3c { xsd:boolean } 7 | 8 | eg.pcd.mix |= 9 | element ex:function { text } 10 | | element ex:type { text } 11 | -------------------------------------------------------------------------------- /tools/expathspec/src/xmlspec.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | 13 | 14 | 15 | http://expath.org/ns/xmlspec/xmlspec.xsl 16 | 17 | 18 | code.function { font-weight: bold; } 19 | code.type { font-style: italic; } 20 | /* h1, h2, h3 { color: #84001C; background: white } */ 21 | /* a, :link, :visited, a:active { color: #84005C; background: white } */ 22 | body { 23 | background-image: url( 24 | 25 | ); 26 | } 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /tools/expathspec/xproject/cxan.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The EXPath-specific layer on top of XMLSpec format. 5 | 6 | 7 | Florent Georges 8 | 9 | Document types 10 | 11 | expath 12 | spec 13 | 14 | 15 | -------------------------------------------------------------------------------- /tools/expathspec/xproject/project.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | The EXPathSpec format, an extension of W3C XMLSpec 7 | 8 | https://github.com/fgeorges/expath-cg/tree/master/tools/expathspec/ 9 | 10 | 11 | 12 | 13 | http://expath.org/ns/xmlspec/xmlspec.rnc 14 | xmlspec.rnc 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /tools/expathtest/README.md: -------------------------------------------------------------------------------- 1 | EXPath Test Tools 2 | ===== 3 | 4 | Contains various tools for use in generating and documenting qt3 test suites. 5 | 6 | -------------------------------------------------------------------------------- /tools/expathtest/test-expand.xsl: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 |

This stylesheet expands a set of qt3 tests in three principal ways:

9 |
    10 |
  • Expanding inclusions via either include elements, which is being 11 | deprecated, or a processing instruction named include.
  • 12 |
  • Applying common properties to a set of tests, gathered under an expand 13 | parent. This can also auto-name-number children.
  • 14 |
  • Replacing namespace prefixes with Clark notation in places where non-standard 15 | prefixes aren't bound, such as in assertions
  • 16 |
17 |
18 | 19 | 20 | 21 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 37 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 |
103 | -------------------------------------------------------------------------------- /tools/fos/src/analyze-string.xsd: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /tools/fos/src/xml.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /tools/xmlspec/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | -------------------------------------------------------------------------------- /tools/xmlspec/src/base.css: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 1997-2003 W3C (MIT, ERCIM, Keio). All Rights Reserved. 3 | The following software licensing rules apply: 4 | http://www.w3.org/Consortium/Legal/copyright-software */ 5 | 6 | /* $Id: base.css,v 1.25 2006/04/18 08:42:53 bbos Exp $ */ 7 | 8 | body { 9 | padding: 2em 1em 2em 70px; 10 | margin: 0; 11 | font-family: sans-serif; 12 | color: black; 13 | background: white; 14 | background-position: top left; 15 | background-attachment: fixed; 16 | background-repeat: no-repeat; 17 | } 18 | :link { color: #00C; background: transparent } 19 | :visited { color: #609; background: transparent } 20 | a:active { color: #C00; background: transparent } 21 | 22 | a:link img, a:visited img { border-style: none } /* no border on img links */ 23 | 24 | a img { color: white; } /* trick to hide the border in Netscape 4 */ 25 | @media all { /* hide the next rule from Netscape 4 */ 26 | a img { color: inherit; } /* undo the color change above */ 27 | } 28 | 29 | th, td { /* ns 4 */ 30 | font-family: sans-serif; 31 | } 32 | 33 | h1, h2, h3, h4, h5, h6 { text-align: left } 34 | /* background should be transparent, but WebTV has a bug */ 35 | h1, h2, h3 { color: #005A9C; background: white } 36 | h1 { font: 170% sans-serif } 37 | h2 { font: 140% sans-serif } 38 | h3 { font: 120% sans-serif } 39 | h4 { font: bold 100% sans-serif } 40 | h5 { font: italic 100% sans-serif } 41 | h6 { font: small-caps 100% sans-serif } 42 | 43 | .hide { display: none } 44 | 45 | div.head { margin-bottom: 1em } 46 | div.head h1 { margin-top: 2em; clear: both } 47 | div.head table { margin-left: 2em; margin-top: 2em } 48 | 49 | p.copyright { font-size: small } 50 | p.copyright small { font-size: small } 51 | 52 | @media screen { /* hide from IE3 */ 53 | a[href]:hover { background: #ffa } 54 | } 55 | 56 | pre { margin-left: 2em } 57 | /* 58 | p { 59 | margin-top: 0.6em; 60 | margin-bottom: 0.6em; 61 | } 62 | */ 63 | dt, dd { margin-top: 0; margin-bottom: 0 } /* opera 3.50 */ 64 | dt { font-weight: bold } 65 | 66 | pre, code { font-family: monospace } /* navigator 4 requires this */ 67 | 68 | ul.toc, ol.toc { 69 | list-style: disc; /* Mac NS has problem with 'none' */ 70 | list-style: none; 71 | } 72 | 73 | @media aural { 74 | h1, h2, h3 { stress: 20; richness: 90 } 75 | .hide { speak: none } 76 | p.copyright { volume: x-soft; speech-rate: x-fast } 77 | dt { pause-before: 20% } 78 | pre { speak-punctuation: code } 79 | } 80 | 81 | -------------------------------------------------------------------------------- /tools/xmlspec/xproject/cxan.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The W3C XMLSpec format. 5 | 6 | 7 | Norman Walsh 8 | Florent Georges 9 | 10 | Document types 11 | 12 | spec 13 | w3c 14 | 15 | 16 | -------------------------------------------------------------------------------- /tools/xmlspec/xproject/project.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | The W3C XMLSpec format 7 | 8 | http://w3.org/2002/xmlspec/ 9 | 10 | 11 | http://w3.org/2002/xmlspec/xmlspec.xsl 12 | xmlspec.xsl 13 | 14 | 15 | http://w3.org/2002/xmlspec/diffspec.xsl 16 | diffspec.xsl 17 | 18 | 19 | http://w3.org/2002/xmlspec/xmlspec.xsd 20 | xmlspec.xsd 21 | 22 | 23 | http://w3.org/2002/xmlspec/xmlspec.rng 24 | xmlspec.rng 25 | 26 | 27 | http://w3.org/2002/xmlspec/xmlspec.rnc 28 | xmlspec.rnc 29 | 30 | 31 | -//W3C//DTD Specification V2.10//EN 32 | http://www.w3.org/2002/xmlspec/dtd/2.10/xmlspec.dtd 33 | xmlspec.dtd 34 | 35 | 36 | 37 | --------------------------------------------------------------------------------