HIP3 xsl

From Code4Lib
Revision as of 16:21, 8 April 2008 by 128.220.205.186 (Talk) (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...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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. Here, we will store all the values in an XSL variable, seperated by commas if there are more than one. 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.