Re: [xsl] mismatched tags with xsl:if

Subject: Re: [xsl] mismatched tags with xsl:if
From: Benjamin Franz <snowhare@xxxxxxxxxxx>
Date: Mon, 12 Mar 2001 09:14:32 -0800 (PST)
On Mon, 12 Mar 2001, Xavier Defrang wrote:

> 
> Hello,
> 
> I run into the following classical issue :
> 
> <xsl:if test="...">
> <tag> <!-- opening tag -->
> </xsl:if>
> ...
> <xsl:if test="...">
> </tag> <!-- corresponding closing tag -->
> </xsl:if>
> 
> I know I read a few times ago how to handle this
> case but I can't remember... was it related to
> xsl:text and it's escaping attribute?  I don't
> know...

<xsl:choose>
 <xsl:when test="...">
  <tag>
   <xsl:apply-templates select="..."/>
  </tag>
 </xsl:when>
 <xsl:otherwise>
  <xsl:apply-templates select="..."/>
 </xsl:otherwise>
</xsl:choose>

Don't fight the language. A template is much like a function in a
procedural language - if you need to do the same (or nearly the same)
thing in two different contexts, put it in a template and call the
template.

-- 
Benjamin Franz

... with proper design, the features come cheaply. This 
approach is arduous, but continues to succeed.

                                     ---Dennis Ritchie


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


Current Thread