Difference between revisions of "HIP3 xsl"
From Code4Lib
(New page: Some XSL snippets useful in Horizon Information Portal 3. h2. Find a displayed attribute On the a full item display, if you know the text of a display field label, you can find the valu...) |
|||
Line 3: | Line 3: | ||
h2. Find a displayed attribute | h2. 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 | + | 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. The string "DISPLAY_LABEL" below is a stand-in for whatever display label you are looking for. |
First we get the index in the diplay of the display label we want: | First we get the index in the diplay of the display label we want: |
Revision as of 16:22, 8 April 2008
Some XSL snippets useful in Horizon Information Portal 3.
h2. 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. The string "DISPLAY_LABEL" below is a stand-in for whatever display label you are looking for.
First we get the index in the diplay 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.