This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Conditional & Preceding-sibling



I wish to only output a value
if a certain attribute of an element
is not the same as the same attribute of
the preceding element at the same level.

So,

  <EQUATION node="one" othero="x">
   <ATOM v="12"><ATOM y="22"/>
  </EQUATION>
  <OTHERTAGS/>
  <EQUATION node="two" othero="y">
   <ATOM v="23"><ATOM y="33"/>
  </EQUATION>

Would only print both equations if
both node values were the same.

Some time ago Ken Holman and Mike Kay
combined to show me the below. Only
six weeks later, having finished other
parts of my project and running large
test do I find that it only seems to
work on the first nodes of a file.

This could be because I'm not really
clear on the preceding-sibling::*[@node][1]/@node
line.... but then printing the preceding-.... 
bit before the xsl:choose block shows
the correct value -- is it my conditional?

<xsl:choose>
  <xsl:when test="not(@node = preceding-sibling::*[@node][1]/@node )">
    <xsl:value-of select="@node"/>:
  </xsl:when>
  <xsl:otherwise>    ;  </xsl:otherwise>
</xsl:choose>

Many thanks in advance,
Lee Goddard

-- 
Lee Goddard  <l.goddard@sussex>
Research Centre for Cognitive Science, 
University of Sussex, Brighton UK


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]