Print

Print


Hi Joe,

see https://www.w3.org/TR/xquery-31/#id-computed-pis for constructing processing instructions in XQuery.
e.g. `processing-instruction {'xml-model'} {'href="http://www.tei-c.org/Vault/P5/3.3.0/xml/tei/custom/schema/relaxng/tei_all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0“'}` will add a xml model PI for the current TEI_all schema.


BTW, your loop could probably be reduced to `$collection//tei:TEI`. This would also remove the document PIs.

Best
Peter

> Am 30.05.2018 um 16:28 schrieb Joe Easterly <[log in to unmask]>:
> 
> Hi,
> 
> I've created an xquery file (see below) which generates a teiCorpus document from a collection of TEI files. I've also created a TEI customization. Is there a way to have xquery or eXist insert an <?xml-model ?> statement at the head of the corpus document, with the URL pointing to my TEI customization RNG file? I've noticed that inside the corpus file, these xml-model statements appear before every TEI element.
> 
> thanks!
> 
> Joe Easterly
> Digital Humanities Librarian
> University of Rochester River Campus Libraries
> 
> xquery version "3.0";
> declare default element namespace "http://www.tei-c.org/ns/1.0";
> declare option exist:serialize "method=xml media-type=text/xml";
> declare variable $collection := collection('/db/mcelroy/tei');
> 
> (:BEGIN-SCRIPT-DOCUMENTATION
> |TITLE Corpus Generator for Nellie McElroy Ledgers
> |CREATOR Joe Easterly
> |UPDATED 2018-05-30
> |DESCRIPTION This script collects TEI files from the Nellie McElroy ledgers into a corpus file.
> |LICENSE This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International
>          License. To view a copy of this license, visit
>          http://creativecommons.org/licenses/by-sa/4.0/.
> END-SCRIPT-DOCUMENTATION
> :)
> <teiCorpus>
>     <teiHeader>
>         <fileDesc>
>             <titleStmt>
>                 <title>Nellie McElroy Ledger</title>
>             </titleStmt>
>             <publicationStmt>
>                 <p>Released by the University of Rochester River Campus Libraries</p>
>             </publicationStmt>
>             <sourceDesc>
>                 <p>Nellie L McElroy Journal, 1913-1916. Manuscript Collection CY.21. Journal of work
>                     as Rochester's first policewoman.</p>
>             </sourceDesc>
>         </fileDesc>
>     </teiHeader>
>     {
>         for $collItem in $collection
>         let $page := base-uri($collItem)
>         return
>             doc($page)
>     }
> </teiCorpus>
>