RE: [xsl] how to conditionally insert begnining and ending tags S EPERATELY in xsl style sheet?

Subject: RE: [xsl] how to conditionally insert begnining and ending tags S EPERATELY in xsl style sheet?
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Mon, 8 Jan 2001 18:48:33 -0000
> 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


Current Thread