TPAC: Handle multiple matches for an XPath expression user/dbs/lp1009980
authorDan Scott <dan@coffeecode.net>
Fri, 15 Jun 2012 17:25:29 +0000 (13:25 -0400)
committerDan Scott <dan@coffeecode.net>
Fri, 15 Jun 2012 18:40:12 +0000 (14:40 -0400)
commite7d303e60454ad1f8813dd69ec59ca1eecc5fae6
treedfc0da03968e77f765d8585cc06544550c333b5c
parent8c7eedc44c26e5825a2a35fd165cfc3ccd3b896d
TPAC: Handle multiple matches for an XPath expression

Per LP 1009980, "If a record has multiple subfield b's in the 260 field,
tpac will not display the publisher or publication date in the record
details page and will not display the publisher on the search results
page".

This is because we're calling textContent on a nodeset, rather than an
individual node, and therefore get null back rather than any content.

To avoid this, always expect a nodeset and iterate over it to populate a
list of the strings.  To maintain the same semantics of expecting a
single text string back for, say, args.pubdate, we define the list as
args.pubdates (plural name), and then grab the first item from the list
and populate that as args.pubdate (singular name).

Signed-off-by: Dan Scott <dan@coffeecode.net>
Open-ILS/src/templates/opac/parts/misc_util.tt2