[XML4Lib] MarcXML and XQuery

Kevin S. Clarke ksclarke at gmail.com
Wed Jan 11 16:19:26 EST 2006


Hey Andrew,

It's probably just the missing namespace; try:

declare namespace marcxml = "http://www.loc.gov/MARC21/slim";
for $record in collection("/db/marcxmlrecs")//marcxml:datafield[@tag="245"]/marcxml:subfield[@code="a"]
return $record

but that just returns the subfield.  I think what you really want is the record:

declare namespace marcxml = "http://www.loc.gov/MARC21/slim";
for $record in collection("/db/marcxmlrecs")
where $record//marcxml:datafield[@tag="245"]/marcxml:subfield[@code="a"]
return $record

Hope that helps...

Kevin


On 1/11/06, Andrew Nagy <andrew.nagy at villanova.edu> wrote:
> I am trying to build some xquery statements to query a collection of
> MARCXML documents but am running into some difficulties.  Can anyone
> suggest what I may be doing wrong or post some examples of good xquery
> statements?
>
> declare namespace marcxml="http://www.loc.gov/MARC21/slim";
> for $record in
> //subfield[@code="a" and contains(.,"A")]
> return $record
>
> This returns 0 hits ...
> I also tried this with the same response:
>
> declare namespace marcxml="http://www.loc.gov/MARC21/slim";
> for $record in
> //datafield[@tag="245"]/subfield[@code="a" and contains(.,"A")]
> return $record
>
> Thanks for the help
> Andrew
>
> _______________________________________________
> XML4Lib mailing list
> XML4Lib at webjunction.org
> http://lists.webjunction.org/mailman/listinfo/xml4lib
>


More information about the XML4Lib mailing list