TPAC: Handle multiple matches for an XPath expression user/bshum/lp1009980
authorDan Scott <dan@coffeecode.net>
Fri, 15 Jun 2012 17:25:29 +0000 (13:25 -0400)
committerBen Shum <bshum@biblio.org>
Wed, 27 Jun 2012 17:50:12 +0000 (13:50 -0400)
commitc0f135e67b87488e6aa0a7a647ec862ff51216cb
tree21c24b1f6b24b1f6c6c635c2d8d7af2f835aec33
parent68a4e3b1c8133c9c98503f5d2128e054bf1d2114
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>
Signed-off-by: Ben Shum <bshum@biblio.org>
Open-ILS/src/templates/opac/parts/misc_util.tt2