Conditional testing

This is a problem I'm trying to sort out and I know the problem exists either in my variable set up, my paths, or perhaps in my xsl:if argument.

I want my heading ([Container Type] Title Date) to display only when the container type is different than the previous c02 container. Since all my c02s have two containers, I want the headings to display if either type is different. I am not displaying the box heading or number and do not want the heading to reappear when the box (or first container) number changes; only when the type changes.

I have tried identifying the value of the "type" attribute in different ways and I have altered the paths numerous times. The xml parses and transforms but without the intended effect. As the code is (below) the heading is showing up for every unit. I am just beginning to learn xslt so it wouldn't surprise me if there are big problems here.

<xsl:variable name="container-type" select="container/@type"/>
<xsl:variable name="following-sibling-container-type" select="container/following-sibling::container/@type"/>
<xsl:if test="not (../preceding-sibling::did/container/@type=$container-type) or not (../preceding-sibling::did/container/following-sibling::container/@type=$following-sibling-container-type)">

<tr><td width="15%" valign="top"><b><xsl:value-of select="container/following-sibling::container/@type"/></b></td><td width="65%" valign="top"><b>Title</b></td><td width="20%" valign="top"><b>Date</b></td></tr>

<tr><td width="15%" valign="top"><xsl:value-of select="container/following-sibling::container"/></td><td width="65%" valign="top"><b><xsl:value-of select="./unittitle"/></b></td><td width="20%" valign="top"><xsl:value-of select="./unitdate"/></td></tr>

Feel free to reply on or off list; I appreciate any help.


Jonathan Lill
Project Archivist
Museum Archives
[log in to unmask]