This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: how to conditionally insert begnining and ending tags S EPERATELY in xsl style sheet?
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>, "'Yao, Mingdong'" <Mingdong dot Yao at Bestbuy dot com>
- Subject: RE: [xsl] how to conditionally insert begnining and ending tags S EPERATELY in xsl style sheet?
- From: Kay Michael <Michael dot Kay at icl dot com>
- Date: Mon, 8 Jan 2001 18:48:33 -0000
- Reply-To: xsl-list at lists dot mulberrytech dot com
> The code I wanted to do is like follows:
>
> <xsl:if test="variable='A'">
> <tr>
> </xsl:if>
> <td>
> (any code)
> </td>
> <xsl:if test="variable='A'">
> </tr>
> </xsl:if>
>
> This is not accepted of course. Is there any way to acomplish this?
<xsl:variable name="common">
<td>(any code)</td>
</xsl:variable>
<xsl:choose>
<xsl:when test="variable='A'">
<tr><xsl:copy-of select="$common"/></tr>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$common"/>
</xsl:otherwise>
</xsl:choose>
Mike Kay
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list