Ниже у вас есть пример кода:
ой код
<table cellspacing="0" cellpadding="0"><tbody>
<tr>
<xsl:for-each select="/*/nearme/location">
<td>
<input type="radio" name="rf" id="rf" class="page_checkbox"/><label for="rf1"><span></span><xsl:value-of select="."/></label>
</td>
<xsl:if test="position() mod 5=0">
</tr><tr>
</xsl:if>
</xsl:for-each>
</tr>
</tbody></table>
Если вы посмотрите, естьxsl if test
который определяет, является ли позиция модулем 5. Когда это произойдет, я хочу закончитьtr
и начать новыйtr
однако это ломается с этим текущим кодом.
Есть идеи, как это решить?
ОБНОВИТЬ:
Вот мой XML:
<nearme>
<location id="538">Pleasures</location>
<location id="541">Baby Dolls</location>
<location id="1521">Michelle's Beach House</location>
<location id="1886">Wild Wild West Gentlemen's Club</location>
<location id="993">Sadies</location>
<location id="5381">ABC</location>
<location id="541">DEF</location>
<location id="1521">ghi</location>
<location id="1886">FDFFDSFD</location>
<location id="993">HGHHFH</location>
</nearme>
И вот мой ожидаемый результат:
<table cellspacing="0" cellpadding="0"><tbody>
<tr>
<td>
<input type="radio" name="rf" id="rf1" class="page_checkbox"/><label for="rf1"><span></span>Pleasures</label>
</td>
<td>
<input type="radio" name="rf" id="rf2" class="page_checkbox"/><label for="rf2"><span></span>Baby Dolls</label>
</td>
<td>
<input type="radio" name="rf" id="rf3" class="page_checkbox"/><label for="rf3"><span></span>Michelle's Beach House</label>
</td>
<td>
<input type="radio" name="rf" id="rf4" class="page_checkbox"/><label for="rf4"><span></span>Wild Wild West Gentlemen's Club</label>
</td>
<td>
<input type="radio" name="rf" id="rf5" class="page_checkbox"/><label for="rf5"><span></span>Sadies</label>
</td>
</tr>
<tr>
<td>
<input type="radio" name="rf" id="rf6" class="page_checkbox"/><label for="rf6"><span></span>ABC</label>
</td>
<td>
<input type="radio" name="rf" id="rf7" class="page_checkbox"/><label for="rf7"><span></span>DEF</label>
</td>
<td>
<input type="radio" name="rf" id="rf8" class="page_checkbox"/><label for="rf8"><span></span>ghi</label>
</td>
<td>
<input type="radio" name="rf" id="rf9" class="page_checkbox"/><label for="rf9"><span></span>FDFFDSFD</label>
</td>
<td>
<input type="radio" name="rf" id="rf10" class="page_checkbox"/><label for="rf10"><span></span>HGHHFH</label>
</td>
</tr>
</tbody></table>