|
| 1 | +(: |
| 2 | + : eXist-db Open Source Native XML Database |
| 3 | + : Copyright (C) 2001 The eXist-db Authors |
| 4 | + : |
| 5 | + |
| 6 | + : http://www.exist-db.org |
| 7 | + : |
| 8 | + : This library is free software; you can redistribute it and/or |
| 9 | + : modify it under the terms of the GNU Lesser General Public |
| 10 | + : License as published by the Free Software Foundation; either |
| 11 | + : version 2.1 of the License, or (at your option) any later version. |
| 12 | + : |
| 13 | + : This library is distributed in the hope that it will be useful, |
| 14 | + : but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | + : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | + : Lesser General Public License for more details. |
| 17 | + : |
| 18 | + : You should have received a copy of the GNU Lesser General Public |
| 19 | + : License along with this library; if not, write to the Free Software |
| 20 | + : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 21 | + :) |
| 22 | +xquery version "3.1"; |
| 23 | + |
| 24 | +module namespace testTransform="http://exist-db.org/xquery/test/function_transform"; |
| 25 | +import module namespace xmldb="http://exist-db.org/xquery/xmldb"; |
| 26 | + |
| 27 | +declare namespace test="http://exist-db.org/xquery/xqsuite"; |
| 28 | + |
| 29 | +declare variable $testTransform:doc := document { |
| 30 | +<TEI xmlns="http://www.tei-c.org/ns/1.0" xml:id="output"> |
| 31 | + <teiHeader> |
| 32 | + <fileDesc> |
| 33 | + <titleStmt> |
| 34 | + <title/> |
| 35 | + </titleStmt> |
| 36 | + <publicationStmt> |
| 37 | + <p>Test document</p> |
| 38 | + </publicationStmt> |
| 39 | + <sourceDesc> |
| 40 | + <p>born digital</p> |
| 41 | + </sourceDesc> |
| 42 | + </fileDesc> |
| 43 | + </teiHeader> |
| 44 | + <text> |
| 45 | + <front> |
| 46 | + <div xml:id="pressrelease" type="section" subtype="press-release"> |
| 47 | + <head>Press Release</head> |
| 48 | + </div> |
| 49 | + </front> |
| 50 | + <body> |
| 51 | + <div type="compilation" xml:id="comp"> |
| 52 | + <head>Main Book</head> |
| 53 | + <div type="chapter" xml:id="ch1"> |
| 54 | + <head>Chapter One</head> |
| 55 | + <div type="document" n="1" xml:id="d1"/> |
| 56 | + <div type="document" n="2" xml:id="d2"/> |
| 57 | + <div type="document" n="3" xml:id="d3"/> |
| 58 | + <div type="document" n="4" xml:id="d4"/> |
| 59 | + <div type="document" n="5" xml:id="d5"/> |
| 60 | + <div type="document" n="6" xml:id="d6"/> |
| 61 | + <div type="document" n="7" xml:id="d7"/> |
| 62 | + </div> |
| 63 | + <div type="chapter" xml:id="ch2"> |
| 64 | + <head>Chapter Two</head> |
| 65 | + <div type="document" n="8" xml:id="d8"/> |
| 66 | + <div type="document" n="9" xml:id="d9"/> |
| 67 | + <div type="document" n="10" xml:id="d10"/> |
| 68 | + <div type="document" n="11" xml:id="d11"/> |
| 69 | + <div type="document" n="12" xml:id="d12"/> |
| 70 | + <div type="document" n="13" xml:id="d13"/> |
| 71 | + <div type="document" n="14" xml:id="d14"/> |
| 72 | + <div type="document" n="15" xml:id="d15"/> |
| 73 | + </div> |
| 74 | + <div type="chapter" xml:id="ch3"> |
| 75 | + <head>Chapter Three</head> |
| 76 | + <div type="document" n="16" xml:id="d16"/> |
| 77 | + <div type="document" n="17" xml:id="d17"/> |
| 78 | + <div type="document" n="18" xml:id="d18"/> |
| 79 | + <div type="document" n="19" xml:id="d19"/> |
| 80 | + <div type="document" n="20" xml:id="d20"/> |
| 81 | + <div type="document" n="21" xml:id="d21"/> |
| 82 | + </div> |
| 83 | + <div type="chapter" xml:id="ch4"> |
| 84 | + <head>Chapter Four</head> |
| 85 | + <div type="document" n="22" xml:id="d22"/> |
| 86 | + <div type="document" n="23" xml:id="d23"/> |
| 87 | + <div type="document" n="24" xml:id="d24"/> |
| 88 | + <div type="document" n="25" xml:id="d25"/> |
| 89 | + <div type="document" n="26" xml:id="d26"/> |
| 90 | + <div type="document" n="27" xml:id="d27"/> |
| 91 | + <div type="document" n="28" xml:id="d28"/> |
| 92 | + </div> |
| 93 | + </div> |
| 94 | + </body> |
| 95 | + </text> |
| 96 | +</TEI> |
| 97 | +}; |
| 98 | + |
| 99 | +declare |
| 100 | + %test:assertEquals("<div class=""toc""><div class=""toc__header""><h4 class=""title"">Contents</h4></div><nav aria-label=""Side navigation,,,"" class=""toc__chapters""><ul class=""chapters js-smoothscroll""><li data-tei-id=""pressrelease""><a href=""/output/pressrelease"">Press Release</a></li><li data-tei-id=""comp""><a href=""/output/comp"">Main Book</a> (Documents 1 - 28)<ul class=""chapters__nested""><li data-tei-id=""ch1"" data-tei-documents=""d1 d2 d3 d4 d5 d6 d7""><a href=""/output/ch1"">Chapter One</a> (Documents 1 - 7)</li><li data-tei-id=""ch2"" data-tei-documents=""d8 d9 d10 d11 d12 d13 d14 d15""><a href=""/output/ch2"">Chapter Two</a> (Documents 8 - 15)</li><li data-tei-id=""ch3"" data-tei-documents=""d16 d17 d18 d19 d20 d21""><a href=""/output/ch3"">Chapter Three</a> (Documents 16 - 21)</li><li data-tei-id=""ch4"" data-tei-documents=""d22 d23 d24 d25 d26 d27 d28""><a href=""/output/ch4"">Chapter Four</a> (Documents 22 - 28)</li></ul></li></ul></nav></div>") |
| 101 | +function testTransform:issue-4609() { |
| 102 | + let $create-collection := xmldb:create-collection("/db", "fn_transform_issue_4609") |
| 103 | + let $doc-store := xmldb:store("/db/fn_transform_issue_4609", "input.xml", $testTransform:doc) |
| 104 | + |
| 105 | + (: this works :) |
| 106 | + let $result := ( fn:transform(map{ |
| 107 | + "stylesheet-location": 'resource:/org/exist/xquery/tei-toc.xsl', |
| 108 | + "source-node": doc('/db/fn_transform_issue_4609/input.xml') |
| 109 | + })) |
| 110 | + return $result?output |
| 111 | +}; |
0 commit comments