xsl-list
[Top] [All Lists]

RE: preceding sibling

2004-04-19 11:02:46
-----Original Message-----
From: Kaarle Kaila [mailto:kaarle(_dot_)kaila(_at_)iki(_dot_)fi]


Hi,

<snip />
I tried this but it compared to names too far back. The comparision should
be made only to name/givenname elements withing notice[(_at_)tag='NAME']
elements
whithin a person element.


And this would be false when... the first preceding notice node with an @tag
equal to 'NAME' occurs outside of the current person node (?)

The suggestion you gave compared also with a name of the previous
person and that should be avoided.

[yup! delete question-mark from the above :) ]

So, you need the first preceding notice node with @tag equal to 'NAME'
having the same person ancestor as the current node...

You could try:

<xsl:template match="givenname">
  <xsl:variable name="vPID" select="generate-id(ancestor::person)" />

  <xsl:if test="not(preceding::notice[(_at_)tag='NAME'
            and generate-id(ancestor::person)=$vPID][1]/name/givenname[
              .=current()])">
    <xsl:value-of select="." />
  </xsl:if>
</xsl:template>

and see if that matches what you are looking for.



Cheers,

Andreas



<Prev in Thread] Current Thread [Next in Thread>