[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|