Note that there are some explanatory texts on larger screens.

plurals
  1. POXSL for-each. incorrect output in tr tag
    text
    copied!<p>There is my problem: I have to do table with products in my site with xslt. Here is how should it looks:</p> <p><img src="https://i.stack.imgur.com/Bri8p.jpg" alt="How should it looks"></p> <p>Now it looks like this:</p> <p><img src="https://i.stack.imgur.com/6fqs7.jpg" alt="Looks now"></p> <p>So, my question is how to do these dividing lines between <code>&lt;tr&gt;</code> tags?</p> <p><img src="https://i.stack.imgur.com/O5jHu.jpg" alt="enter image description here"></p> <p>Here is my code:</p> <pre><code> &lt;table id="producers_table" &gt; &lt;xsl:for-each select="document('udata://catalog/getCategoryList/void/producers//1/')/udata/items/item[not(@country=preceding-sibling::item/@country)]" &gt; &lt;xsl:variable name="country_name" select="@country" /&gt; &lt;xsl:variable name="country_count" select="count($country_name)"/&gt; &lt;tr id="test"&gt; &lt;td id="country_td"&gt; &lt;xsl:value-of select="document(concat('uobject://', $country_name))/udata/object/@name"/&gt; &lt;/td&gt; &lt;xsl:for-each select="../item[@country = $country_name]"&gt; &lt;xsl:variable name="prod_count" select="document(concat('udata://catalog/getCountObjects/', @id))/udata"/&gt; &lt;td umi:element-id="{@id}"&gt; &lt;a href="{@link}" umi:field-name="name" umi:delete="delete" umi:empty="&amp;empty-section-name;"&gt; &lt;table class="object_table"&gt; &lt;tr&gt; &lt;td align="center"&gt; &lt;img src="{document(concat('upage://', @id, '.header_pic'))//value}"/&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align="center" id="search_by_appointment_name"&gt; &lt;p&gt; &lt;span&gt;&lt;xsl:variable name="curr_producer_name" select="."/&gt; &lt;xsl:value-of select="$curr_producer_name" /&gt; &lt;/span&gt; &amp;#160;&lt;sup class="object_count"&gt;&lt;xsl:value-of select="$prod_count"/&gt;&lt;/sup&gt; &lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/a&gt; &lt;/td&gt; &lt;/xsl:for-each&gt; &lt;/tr&gt; &lt;/xsl:for-each&gt; &lt;/table&gt; </code></pre> <p>Where should I add <code>&lt;hr/&gt;</code>?</p> <p>P.S. Here is some results of my attempts:</p> <p>1.</p> <p><img src="https://i.stack.imgur.com/TmlVS.jpg" alt="Attempt 1"></p> <p>code:</p> <pre><code>&lt;table id="producers_table" &gt; &lt;xsl:for-each select="document('udata://catalog/getCategoryList/void/producers//1/')/udata/items/item[not(@country=preceding-sibling::item/@country)]" &gt; &lt;xsl:variable name="country_name" select="@country" /&gt; &lt;xsl:variable name="country_count" select="count($country_name)"/&gt; &lt;tr id="test"&gt; **&lt;hr/&gt;** </code></pre> <p>2.</p> <p><img src="https://i.stack.imgur.com/Va2d2.jpg" alt="Attempt 2"></p> <pre><code>&amp;#160;&lt;sup class="object_count"&gt;&lt;xsl:value-of select="$prod_count"/&gt;&lt;/sup&gt; &lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/a&gt; &lt;/td&gt; &lt;/xsl:for-each&gt; **&lt;hr/&gt;** &lt;/tr&gt; &lt;/xsl:for-each&gt; &lt;/table&gt; </code></pre>
 

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