From: Martin H. <mh...@uv...> - 2012-03-12 12:52:13
|
Hi there, Should your path include <listPerson>? tei:teiHeader/tei:profileDesc/tei:particDesc/tei:listPerson/tei:person/... Or do you need an extra slash after the doc root: let $dob := $doc//tei:teiHeader (the document root is not necessarily the same as the root XML element.) Cheers, Martin On 12-03-11 10:26 PM, Christopher Thomson wrote: > Thanks for your reply. My bibl.xqm module starts like this: > > xquery version "1.0"; > > module namespace bibl = "www.example.org.nz/ns/xquery/bibl"; > > declare namespace bibl = "www.example.org.nz/ns/xquery/bibl"; > declare namespace exist = "http://exist.sourceforge.net/NS/exist"; > declare namespace tei = "http://www.tei-c.org/ns/1.0/"; > > I then import this module into the query where the function is called. I > think declaring the bibl namespace in the module is unnecessary, but > I've been trying various things to get this working, and it doesn't > produce an error. > > Cheers, > Chris > > > On 12/03/12 12:16 PM, Martin Holmes wrote: >> Do you have the tei: prefix correctly declared in your bibl.xqm module? >> >> Cheers, >> Martin >> >> On 12-03-11 12:27 PM, Christopher Thomson wrote: >>> I am creating an module to hold commonly used XQuery expressions as >>> functions. $doc defines the document in my collection of TEI files, and >>> the following returns a date of birth in the desired way: >>> >>> *<div id="sidebar" class="span-6"> >>> <h3><b>{$fullname}</b></h3> >>> >>> let $dob := >>> $doc/tei:teiHeader/tei:profileDesc/tei:particDesc/tei:person/tei:birth >>> return<p>{$dob/text()}</p> >>> </div>* >>> >>> Next, I move this code to a function in a module in the namespace bibl. >>> The above div becomes: >>> >>> *<div id="sidebar" class="span-6"> >>> <h3><b>{$fullname}</b></h3> >>> >>> { bibl:dob($doc) } >>> </div>* >>> >>> The function is declared in the bibl.xqm module thus: >>> >>> *declare function bibl:dob($doc) { >>> let $dob := >>> $doc/tei:teiHeader/tei:profileDesc/tei:particDesc/tei:person/tei:birth >>> return<p>{$dob/text()}</p> >>> };* >>> >>> This arrangement does not return the date of birth to the resulting web >>> page. Does anyone see where the error is here? I have assumed the $doc >>> argument will be passed from the main page to the function in the bibl >>> module. 'bibl' is imported into the main page and seems to be defined >>> correctly as a module. >>> >>> Thanks, >>> Chris >>> |