You need to cheat a bit here in order to make this work
Try writing this
<xsl:if test="position() mod 3 =0"><xsl:text disable-output-escaping="yes"><![CDATA[<tr>]]></xsl:text></xsl:if> - This should be enough and let's the XML parser know it should not try to parse this element.
So to make your </tr> work I guess it should be placed within the same test? Like this
Even if i do this <table><xsl:text
disable-output-escaping="yes"><![CDATA[<tr>]]></xsl:text><xsl:text
disable-output-escaping="yes"><![CDATA[</tr>]]></xsl:text></table>
I get nothing. I can't see the <tr> tag in source of page that i need to show.
You should definently listen to Chriztian on this one and not my evil twin who must have posted earlier *ahem*...:-) That's apparently a study on how NOT to do it. I hang my head in shame and go to the naughty corner for a while.
Thumbs up Chriztian and thanks for making elegant solutions :-)
creating unclosed tag in xslt
I have two nested foreach loop. inner loop generates <td> tags to construct a table. IF i try to add this line
<xsl:if test="position() mod 3 =0"><tr></xsl:if>
Similary another if for </tr> tag.
But when I saves my xslt it gives me error for unclosed <tr> tag.
Please help me how I can do this.
Hi rajeev
You need to cheat a bit here in order to make this work
Try writing this
<xsl:if test="position() mod 3 =0"><xsl:text disable-output-escaping="yes"><![CDATA[<tr>]]></xsl:text></xsl:if> - This should be enough and let's the XML parser know it should not try to parse this element.
So to make your </tr> work I guess it should be placed within the same test? Like this
<xsl:if test="position() mod 3 =0">
<xsl:text disable-output-escaping="yes"><![CDATA[<tr>]]></xsl:text>
<!--your code here-->
<xsl:text disable-output-escaping="yes"><![CDATA[</tr>]]></xsl:text>
</xsl:if>
Does this help?
/Jan
Even if i do this <table><xsl:text disable-output-escaping="yes"><![CDATA[<tr>]]></xsl:text><xsl:text disable-output-escaping="yes"><![CDATA[</tr>]]></xsl:text></table>
I get nothing. I can't see the <tr> tag in source of page that i need to show.
Hi rajeev,
Take a look at my solution for this one: http://our.umbraco.org/forum/developers/xslt/11692-Simple-table-row-example-with-XSLT-templates
which was a modification of this one: http://our.umbraco.org/forum/developers/xslt/11527-Problem-with-listing-HTLM-strcuture-with-XSLT
They show how to properly deal with tables (or other grouped output).
Please ask away here if you need further help - maybe show a little more of your code, so we can guide you as good as possible.
/Chriztian
Hi Rajeev
You should definently listen to Chriztian on this one and not my evil twin who must have posted earlier *ahem*...:-) That's apparently a study on how NOT to do it. I hang my head in shame and go to the naughty corner for a while.
Thumbs up Chriztian and thanks for making elegant solutions :-)
/Jan
is working on a reply...