RE: [xsl] preceding sibling

Subject: RE: [xsl] preceding sibling
From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx>
Date: Mon, 19 Apr 2004 20:02:46 +0200
> -----Original Message-----
> From: Kaarle Kaila [mailto:kaarle.kaila@xxxxxx]
>

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

Current Thread