Note that there are some explanatory texts on larger screens.

plurals
  1. POGenerating multiple dynamic rows of html table using XSLT
    primarykey
    data
    text
    <p>I want to create rows in a table dynamically depending on the content in the XML. In the below code I am trying to create a row(<code>&lt;tr&gt;</code>) with 5 columns. After 5 columns are filled, I want to create a new row.</p> <p>A row can only contain 5 columns as per the below code. If i apply the XSL on the XML, I get an error displaying</p> <blockquote> <p>XSLT compile error. The 'tr' start tag on line 574 does not match the end tag of 'xsl:when'. Line 578, position 7.</p> </blockquote> <pre><code>570:&lt;table&gt; 571: &lt;xsl:for-each select="/alert/account_links/account_links_info"&gt; 572: &lt;xsl:choose&gt; 573: &lt;xsl:when test="position() mod 5 = 1"&gt; 574: &lt;tr&gt; 575: &lt;td&gt; 576: &lt;xsl:value-of select="account_id"/&gt; 577: &lt;/td&gt; 578: &lt;/xsl:when&gt; 579: &lt;xsl:when test="position() mod 5 = 0"&gt; 580: &lt;td&gt; 581: &lt;xsl:value-of select="account_id"/&gt; 582: &lt;/td&gt; 583: &lt;/tr&gt; 584: &lt;/xsl:when&gt; 585: &lt;xsl:otherwise&gt; 586: &lt;td&gt; 587: &lt;xsl:value-of select="account_id"/&gt; 588: &lt;/td&gt; 589: &lt;/xsl:otherwise&gt; 590: &lt;/xsl:choose&gt; 591: &lt;/xsl:for-each&gt; 592: &lt;/table&gt; </code></pre> <p>Input Xml:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" standalone="no"?&gt; &lt;alert&gt; &lt;account_links&gt; &lt;account_links_info&gt; &lt;account_id&gt;1&lt;/account_id&gt; &lt;/account_links_info&gt; &lt;account_links_info&gt; &lt;account_id&gt;2&lt;/account_id&gt; &lt;/account_links_info&gt; &lt;account_links_info&gt; &lt;account_id&gt;3&lt;/account_id&gt; &lt;/account_links_info&gt; &lt;account_links_info&gt; &lt;account_id&gt;4&lt;/account_id&gt; &lt;/account_links_info&gt; &lt;account_links_info&gt; &lt;account_id&gt;5&lt;/account_id&gt; &lt;/account_links_info&gt; &lt;/account_links&gt; &lt;/alert&gt; </code></pre> <p>Can some one help me how to go ahead with this?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload