Re: [xsl] conditional based html formated output - reg

Subject: Re: [xsl] conditional based html formated output - reg
From: Ramesh Kumar <cnrameshkumar@xxxxxxxxx>
Date: Mon, 5 Apr 2010 11:56:33 +0400
Dear all,

Thanks for the guidelines. As suggested I changed the logic. I placed
the <tr></tr> tags in the template where <framematrix>template is
called. And it worked fine.

Regards,
Ramesh

On Fri, Apr 2, 2010 at 8:55 PM, Michael Kay <mike@xxxxxxxxxxxx> wrote:
>
> You're making a fundamental error here in trying to make your stylesheet
> output tags (bits of lexical XML). That's not the way XSLT works:
> instructions create nodes in a tree. The start/end tag pair <tr></tr>
> represent a single node in the tree, which can only be constructed as an
> atomic operation.
>
> It's hard to see what you're trying to do and therefore to show it it
should
> be corrected, but in general you should replace
>
> <xsl:if test="x">
>  <td>
> </xsl:if>
>  xxx
> <xsl:if test="x">
>  </td>
> </xsl:if>
>
> by
>
> <xsl:choose>
>  <xsl:when test="x">
>    <td>
>      xxx
>    </td>
>  </xsl:when>
>  <xsl:otherwise>
>     xxx
>  </xsl:otherwise>
> </xsl:choose>
>
> Regards,
>
> Michael Kay
> http://www.saxonica.com/
> http://twitter.com/michaelhkay
>
>> -----Original Message-----
>> From: Ramesh Kumar [mailto:cnrameshkumar@xxxxxxxxx]
>> Sent: 02 April 2010 11:31
>> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>> Subject: [xsl] conditional based html formated output - reg
>>
>> Dear All,
>>
>> Can anyone help me to clear the error in the below xsl template.
>> I am trying to create a table. The cells are created based on
>> key value.
>> So i need to start a row <TR> based on a condition.
>> Also the end tag </TR> for that row will be based on another
>> condition.
>> But without end tag </TR> the <xsl:if> element is giving error.
>>
>>       <xsl:template name="FrameMatrix">
>>               <xsl:param name="rowkey"/>
>>               <xsl:param name="seqkey"/>
>>               <xsl:param name="colkey"/>
>>               <xsl:if test="not(contains($RowKeyList,
>> concat(',', rowkey)))">
>>                       <tr>
>>                               <td>
>>                                       <xsl:value-of select="RowKey"/>
>>                               </td>
>>                               <td>
>>                                       <xsl:value-of
>> select="CategoryName"/>
>>                               </td>
>>               </xsl:if>
>>
>>               <xsl:for-each select="key('col-name',
>> concat($colkey, $rowkey, $seqkey))">
>>                       <xsl:call-template name="data" />
>>               </xsl:for-each>
>>
>>               <xsl:if test="not(contains($RowKeyList,
>> concat(rowkey, ',')))">
>>                       </tr>
>>               </xsl:if>
>>       </xsl:template>
>>
>> --
>>
>>
>> Regards,
>> Ramesh
>
>



--


Regards,
Ramesh

Current Thread