11(:
2+ : Elemental
3+ : Copyright (C) 2024, Evolved Binary Ltd
4+ :
5+ 6+ : https://www.evolvedbinary.com | https://www.elemental.xyz
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; version 2.1.
11+ :
12+ : This library is distributed in the hope that it will be useful,
13+ : but WITHOUT ANY WARRANTY; without even the implied warranty of
14+ : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+ : Lesser General Public License for more details.
16+ :
17+ : You should have received a copy of the GNU Lesser General Public
18+ : License along with this library; if not, write to the Free Software
19+ : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20+ :
21+ : NOTE: Parts of this file contain code from 'The eXist-db Authors'.
22+ : The original license header is included below.
23+ :
24+ : =====================================================================
25+ :
226 : eXist-db Open Source Native XML Database
327 : Copyright (C) 2001 The eXist-db Authors
428 :
@@ -36,7 +60,9 @@ declare namespace stats="http://exist-db.org/xquery/profiling";
3660declare variable $ct:COLLECTION_CONFIG :=
3761 <collection xmlns = "http://exist-db.org/collection-config/1.0" >
3862 <index xmlns:xs = "http://www.w3.org/2001/XMLSchema"
39- xmlns:tei = "http://www.tei-c.org/ns/1.0" >
63+ xmlns:tei = "http://www.tei-c.org/ns/1.0"
64+ xmlns:other1 = "http://other1"
65+ xmlns:other2 = "http://other2" >
4066 <range>
4167 <create qname = "tei:note" >
4268 <condition attribute = "type" value = "availability" />
@@ -59,6 +85,14 @@ declare variable $ct:COLLECTION_CONFIG :=
5985 <field name = "orig_place" match = "tei:place/tei:placeName" type = "xs:string" case = "no" ></field>
6086 </create>
6187 <create qname = "tei:note" type = "xs:string" case = "no" />
88+ <create qname = "tei:note" >
89+ <condition attribute = "other1:type" value = "other1" />
90+ <field name = "other1" type = "xs:string" case = "no" />
91+ </create>
92+ <create qname = "tei:note" >
93+ <condition attribute = "other2:type" value = "other2" />
94+ <field name = "other2" type = "xs:string" case = "no" />
95+ </create>
6296 <create qname = "tei:placeName" >
6397 <condition attribute = "type" value = "someType" />
6498 <condition attribute = "cert" value = "high" />
@@ -134,7 +168,7 @@ declare variable $ct:COLLECTION_CONFIG :=
134168
135169
136170declare variable $ct:DATA :=
137- <TEI xmlns = "http://www.tei-c.org/ns/1.0" >
171+ <TEI xmlns = "http://www.tei-c.org/ns/1.0" xmlns:other1 = "http://other1" xmlns:other2 = "http://other2" >
138172 <teiHeader>
139173 <fileDesc>
140174 <titleStmt><title>conditional fields!</title></titleStmt>
@@ -143,7 +177,7 @@ declare variable $ct:DATA :=
143177 <msDesc>
144178 <msContents>
145179 <msItemStruct>
146- <note type = "availability" >publiziert</note>
180+ <note type = "availability" other1:type = "other1" >publiziert</note>
147181 <note type = "text_type" >literarisch</note>
148182 <note type = "orig_place" >
149183 <place>
@@ -161,10 +195,11 @@ declare variable $ct:DATA :=
161195 <placeName cert = "high" type = "someOtherType" >Alexandria</placeName>
162196 </place>
163197 </note>
164- <note type = "start_end" >startswithendswith</note>
165- <note>foo</note>
166- <note type = "bar" >foo</note>
167- <note type = "something" >literarisch</note>
198+ <note type = "start_end" other1:type = "other1" other2:type = "other2" >startswithendswith</note>
199+ <note type = "other2" other1:type = "start_end" >foo</note>
200+ <note type = "bar" other2:type = "other2" >foo</note>
201+ <note type = "something" other2:type = "other2" >literarisch</note>
202+ <note xmlns:other1 = "http://not-other-one" other1:type = "other1" >other1-not-same-namespace </note>
168203 </msItemStruct>
169204 </msContents>
170205 </msDesc>
@@ -533,3 +568,20 @@ function ct:optimize-matches-no-case() {
533568collection ($ct:COLLECTION)//tei:p[matches (@type , "bb" )][. = "something" ]
534569};
535570
571+ (:~
572+ : See: https://github.com/eXist-db/exist/issues/5189
573+ :)
574+ declare
575+ %test:assertEquals("publiziert" , "startswithendswith" )
576+ function ct:other1-index-keys () {
577+ range:index-keys-for-field ("other1" , function ($k, $n) { $k }, 10 )
578+ };
579+
580+ (:~
581+ : See: https://github.com/eXist-db/exist/issues/5189
582+ :)
583+ declare
584+ %test:assertEquals("foo" , "literarisch" , "startswithendswith" )
585+ function ct:other2-index-keys () {
586+ range:index-keys-for-field ("other2" , function ($k, $n) { $k }, 10 )
587+ };
0 commit comments