有我的问题: 我必须使用xslt在我的站点中使用产品表。 这是它应该如何看待:
现在看起来像这样:
所以,我的问题是如何在<tr>
标签之间划分界线?
这是我的代码:
<table id="producers_table" >
<xsl:for-each select="document('udata://catalog/getCategoryList/void/producers//1/')/udata/items/item[not(@country=preceding-sibling::item/@country)]" >
<xsl:variable name="country_name" select="@country" />
<xsl:variable name="country_count" select="count($country_name)"/>
<tr id="test">
<td id="country_td">
<xsl:value-of select="document(concat('uobject://', $country_name))/udata/object/@name"/>
</td>
<xsl:for-each select="../item[@country = $country_name]">
<xsl:variable name="prod_count" select="document(concat('udata://catalog/getCountObjects/', @id))/udata"/>
<td umi:element-id="{@id}">
<a href="{@link}" umi:field-name="name" umi:delete="delete" umi:empty="&empty-section-name;">
<table class="object_table">
<tr>
<td align="center">
<img src="{document(concat('upage://', @id, '.header_pic'))//value}"/>
</td>
</tr>
<tr>
<td align="center" id="search_by_appointment_name">
<p>
<span><xsl:variable name="curr_producer_name" select="."/>
<xsl:value-of select="$curr_producer_name" />
</span>
 <sup class="object_count"><xsl:value-of select="$prod_count"/></sup>
</p>
</td>
</tr>
</table>
</a>
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
我应该在哪里添加<hr/>
?
P.S。以下是我尝试的一些结果:
1
代码:
<table id="producers_table" >
<xsl:for-each select="document('udata://catalog/getCategoryList/void/producers//1/')/udata/items/item[not(@country=preceding-sibling::item/@country)]" >
<xsl:variable name="country_name" select="@country" />
<xsl:variable name="country_count" select="count($country_name)"/>
<tr id="test">
**<hr/>**
2
 <sup class="object_count"><xsl:value-of select="$prod_count"/></sup>
</p>
</td>
</tr>
</table>
</a>
</td>
</xsl:for-each>
**<hr/>**
</tr>
</xsl:for-each>
</table>
答案 0 :(得分:2)
在HTML中,将<hr />
直接放在<tr>
中是不合法的。你可以尝试在第二个<xsl:for-each>
:
<tr>
<td colspan="10">
<hr />
</td>
</tr>
但是在这个时代,你不应该使用表格进行布局。我认为这里的正确解决方案是重新编写HTML,因此它使用<div>
而不是表格。然后,将<hr/>
放在您想要的地方应该很容易。
答案 1 :(得分:2)
只需为td
border-bottom: 1px solid gray
的样式标记创建一个css类。这应该会影响您的效果。