This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: mismatched tags with xsl:if


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]