[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: Conditional & Preceding-sibling


Subject: Re: Conditional & Preceding-sibling
From: Lee Goddard <home@xxxxxxxxxxxxxx>
Date: Fri, 18 Aug 2000 15:48:37 +0100

Jeni - looked at your site, which led to your CV, and 
your request for interesting XML/XSL work. I was recently
called by the Progressive recruitment agency asking me to
an interview for a 'major blue-chip client near Reading'
to do something XML/XSL.  I've two weeks to finish my
MSc so turned them down, and both Reading and 'blue-chip'
put me off, but you may find giving them a ring worth
whie.

lee

Jeni Tennison wrote:
> 
> 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

-- 
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



Current Thread