Difference between revisions of "HIP3 xsl"
From Code4Lib
Line 1: | Line 1: | ||
− | Some XSL snippets useful in Horizon Information Portal 3. | + | Some [[XSL]] snippets useful in [[Horizon Information Portal 3]]. |
==Find a displayed attribute== | ==Find a displayed attribute== | ||
Line 22: | Line 22: | ||
Not sure what happens if there is more than one matching value, or more than one matching label. | Not sure what happens if there is more than one matching value, or more than one matching label. | ||
+ | |||
+ | [[Category: HIP3]] |
Latest revision as of 15:58, 25 February 2009
Some XSL snippets useful in Horizon Information Portal 3.
Find a displayed attribute
On the a full item display, if you know the text of a display field label, you can find the value(s) of that label in the HIP XML. This is a pain because HIP's XML is so display-oriented (rather than structurally oriented). The string "DISPLAY_LABEL" below is a stand-in for whatever display label you are looking for.
First we get the index in the order of elements of the display label we want:
<xsl:variable name="field_index" select="count(/searchresponse/fullnonmarc/searchresults/header/col/label[text()='DISPLAY_LABEL']/../preceding-sibling::*)+1" />
Now we pull out the actual value:
<xsl:variable name="value_of_interest" select="/searchresponse/fullnonmarc/searchresults/results/row/cell[$field_index]/data/text/text()" />
You could combine these into one statement if you wanted to make it even more confusing.
Not sure what happens if there is more than one matching value, or more than one matching label.