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: how to conditionally insert begnining and ending tags S EPERATELY in xsl style sheet?


> 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


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