xsl-list
[Top] [All Lists]

RE: find previous node at the same level

2003-04-29 22:15:42
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



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