Subject: Re: Conditional & Preceding-sibling From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx> Date: Fri, 18 Aug 2000 11:26:43 +0100 |
Lee, >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. Have you missed out a 'not' somewhere here? In your first paragraph you said that you wanted them to print if the node values were *not* the same? The 'node' of EQUATION[@node='two'] is equal to 'two'. The preceding EQUATION element at the same level has 'node' equal to 'one'. These are not the same, so the value should be outputted. Right? >This could be because I'm not really >clear on the preceding-sibling::*[@node][1]/@node >line.... preceding-sibling::*[@node][1]/@node says: 1. create a list of all the sibling elements preceding this one, whatever their names 2. from that list, create another list that holds those elements that have a @node attribute 3. from *that* list, take the first one (which is the one immediately preceding the current element) 4. now take the value of it's @node attribute It's the value of that node attribute that's compared to the one for the current element you're processing. And if they're not the same, then the value of the 'node' attribute is outputted. >From reading it, I think that this should work OK. Can you post a test case that shows what it isn't working with? Sorry I can't be more help, Jeni Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Conditional & Preceding-sibling, Lee Goddard | Thread | Re: Conditional & Preceding-sibling, Lee Goddard |
Problem with generate-id() with sty, Paul Terray | Date | Look Ahead in XSL, ciaran byrne |
Month |