RE: [xsl] find previous node at the same level

Subject: RE: [xsl] find previous node at the same level
From: Jarno.Elovirta@xxxxxxxxx
Date: Wed, 30 Apr 2003 08:15:42 +0300
Hi

> <xsl:apply-templates select="item">
> 	if previous node is group... then do blah
> 	
> 	else if previous node is item.... then do blah
> </xsl:apply-templates>
> 
> So when I am in item template how do I find what the
> previous node is ? (In my example it will be the item
> one nodes)

See <http://www.w3.org/TR/xpath#axes>.

  <xsl:choose>
    <xsl:when test="preceding-sibling::*[1][self::group]">
      do blah
    </xsl:when>
    <xsl:when test="preceding-sibling::*[1][self::item]">
      do blah
    </xsl:when>
  </xsl:choose>

Cheers,

Jarno - Linnunradan käsikirja liftareille: Osa 19

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread