RE: [xsl] last() or preceding node if last() have empty text-node selection

Subject: RE: [xsl] last() or preceding node if last() have empty text-node selection
From: "Andrew Welch" <awelch@xxxxxxxxxxxxxxx>
Date: Fri, 24 May 2002 11:32:28 +0100
<xsl:if test="//DARBEDINGUNG[last()]/DARBEDINGUNG.laufzeitbis != '' ">
			<xsl:value-of
select="//DARBEDINGUNG[last()]/DARBEDINGUNG.laufzeitbis"/>
</xsl:if>

I would change your xsl:if to an xsl:choose, like this:

<xsl:choose>
  <xsl:when test="//DARBEDINGUNG[last()]/DARBEDINGUNG.laufzeitbis != ''
">
	<xsl:value-of
select="//DARBEDINGUNG[last()]/DARBEDINGUNG.laufzeitbis"/>
  </xsl:when>
  <xsl:otherwise>
      <xsl:value-of
select="//DARBEDINGUNG[last()-1]/DARBEDINGUNG.laufzeitbis"/>
  </xsl:otherwise>
</xsl:choose>

cheers
andrew

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.350 / Virus Database: 196 - Release Date: 17/04/2002
 

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


Current Thread