[XML4Lib] elegant select statement

Binkley, Peter Peter.Binkley at ualberta.ca
Thu May 3 10:42:45 EDT 2007


//varfield[@id='245']/subfield[@label='a'] will return every subfield
"a" that is the child of a varfield "245" in the record. Depending on
where you're navigating from you should replace the initial // with
something more specific, e.g. from the top it would be
/present/record/metadata/oai_marc/varfield... .  

Peter

-----Original Message-----
From: xml4lib-bounces at webjunction.org
[mailto:xml4lib-bounces at webjunction.org] On Behalf Of Eric Lease Morgan
Sent: Thursday, May 03, 2007 8:21 AM
To: Aleph X-Server; xml4lib
Subject: [XML4Lib] elegant select statement


Given the following XML snippet, what is an elegant select statement I
can use to extract the value of 245 subfield a:

<?xml version="1.0" encoding="utf-8"?>
<present>
<record>
   <record_header>
    <set_entry>000000001</set_entry>
   </record_header>
   <doc_number>2013156</doc_number>
   <metadata>
    <oai_marc>
     <varfield id="100" i1="1" i2="">
      <subfield label="a">Allen, Christopher,</subfield>
      <subfield label="d">1953-</subfield>
     </varfield>
     <varfield id="245" i1="1" i2="0">
      <subfield label="a">French painting in the Golden Age /</subfield>
      <subfield label="c">Christopher Allen.</subfield>
     </varfield>
    </oai_marc>
   </metadata>
</record>
</present>

To what degree do I have to create bunches o' loops testing the value of
id in varfield and repeating the process by testing the value of
subfields and labels. There has to be an easier way!

-- 
Eric Lease Morgan
University Libraries of Notre Dame

(574) 631-8604


_______________________________________________
XML4Lib mailing list
XML4Lib at webjunction.org
http://lists.webjunction.org/mailman/listinfo/xml4lib


More information about the XML4Lib mailing list