This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: mismatched tags with xsl:if
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] mismatched tags with xsl:if
- From: "Michael Kay" <mhkay at iclway dot co dot uk>
- Date: Mon, 12 Mar 2001 19:53:21 -0000
- Reply-To: xsl-list at lists dot mulberrytech dot com
> 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