search xi:inlude in xpath without resolving
Posted: Tue Feb 14, 2017 3:38 am
Hi, this seems like it should be easy but I can't solve it or find an answer. I want to find xi:include elments via xpath, not what the xi:includes resloves to. I can't seem to do this with either the xpath dialog or the xpath/xquery builder.
//xi:include returns no results. But //bibliomixed does. <bibliomixed> elements are referenced by the xi:includes. More specifically I want to execute the following xquery which returns empty <by-owc> elements, which is not what I want or expect. There are matches in in the source document for all the xpointer values.
I can search for elements inside the xi:include element after it has been resolved. My document with the xi:includes looks something like below, though with many more <xi:include> elements.:
and my document pointed to by the xi:includes looks something like below, though with many more <bibliomixed> elements. The matches aren't shown because the two documents are ordered differently.
//xi:include returns no results. But //bibliomixed does. <bibliomixed> elements are referenced by the xi:includes. More specifically I want to execute the following xquery which returns empty <by-owc> elements, which is not what I want or expect. There are matches in in the source document for all the xpointer values.
Code: Select all
declare default element namespace "http://docbook.org/ns/docbook";
declare namespace xi="http://www.w3.org/2001/XInclude";
declare variable $source-doc := doc("hraf.docbook.bib_source.xml");
declare variable $owc-doc := doc("hraf.docbook.bib_by_owc.xml");
<sets xmlns="http://docbook.org/ns/docbook">
{
for $source-id in $source-doc//bibliomixed/@xml:id/string()
return
<set>
<source> {$source-id}</source>
<by-owc>{$owc-doc//xi:include[@xpointer=$source-id]/@xpointer/string()}</by-owc>
</set>
}
</sets>
Code: Select all
<bibliography xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://docbook.org/ns/docbook"
role="hraf-collection-materials-global-bibliography"
ocms="113">
<bibliodiv>
<title>AQ43 Early Indus</title>
<xi:include href="hraf.docbook.bib_source.xml"
xpointer="Dales1979TheBalakotProjectSummaryofFourYearsofExcavationsinPakistan"/>
<xi:include href="hraf.docbook.bib_source.xml"
xpointer="Durrani1988ExcavationsintheGomalValleyRehmanDheriExcavationReportNo1"/>
<xi:include href="hraf.docbook.bib_source.xml"
xpointer="Durrani1991FurtherExcavationsatRehmanDheri"/>
</bibliodiv>
</bibliography>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<bibliography xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://docbook.org/ns/docbook"
role="hraf-collection-materials-global-bibliography" ocms="113">
<bibliomixed xml:id="blank-template"/>
<bibliomixed xml:id="Agboton1997CulturedesPeuplesduBnin">
<info>
<sid uuid="aa94f366-14bd-4af3-a782-a1042d0e1bf1">
<sowc code="fa18" term="Fon">
<socm code="113" term="Bibliographies in sources"/>
</sowc>
</sid>
</info>
<author>
<personname>
<surname>Agboton</surname>, Gaston A. M.</personname>
</author>
<pubdate>1997</pubdate>. <title role="book">Culture des Peuples du Bénin</title>. Dakar,
Senegal: Présence Africaine.</bibliomixed>
<bibliomixed xml:id="Alladaye2003LeCatholicismeauPaysduVodun">
<info>
<sid uuid="ce82800e-6400-41e3-89b6-0d497b7065e3">
<sowc code="fa18" term="Fon">
<socm code="113" term="Bibliographies in sources"/>
</sowc>
</sid>
</info>
<author>
<personname>
<surname>Alladaye</surname>, Jérôme.</personname>
</author>
<pubdate>2003</pubdate>. <title role="book">Le Catholicisme au Pays du Vodun</title>.
Cotonou, Benin: Editions Flamboyant.</bibliomixed>
</bibliography>