[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] mismatched tags with xsl:if


Subject: RE: [xsl] mismatched tags with xsl:if
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Mon, 12 Mar 2001 19:53:21 -0000

> I run into the following classical issue :
>
> <xsl:if test="...">
> <tag> <!-- opening tag -->
> </xsl:if>
> ...
> <xsl:if test="...">
> </tag> <!-- corresponding closing tag -->
> </xsl:if>

This basically means you're thinking in terms of writing tags to an output
file, not writing nodes to a tree (you can't write half a node). You have to
find some way of changing the logic to:

<xsl:choose>
<xsl:when test="...">
   <tag>
      <xsl:call-template name="write-content"/>
   </tag>
</xsl:when>
<xsl:otherwise>
  <xsl:call-template name="write-content"/>
</xsl:otherwise>
</xsl:choose>

Mike Kay
Software AG


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



Current Thread