Xslt - adding </tr> <tr> of each n node?
I found an elegant solution for this problem: xsl for-each: add code block every n lines?
I would like to understand the xslt code, and I was wondering if you can help me figure this out by looking at the link above.
Mostly there are 3 <xsl:template>. For me, the first two are enough to achieve the goal. However, I tried only 2 <xsl:template>and it does not work. In short, a third is required. There he is:
<xsl:template match="gallery[not(position() mod 6 = 1)]"/>
The second template has a mode, while the latter does not.
I have no idea when the latter is being executed. Could you help me figure it out?
Thank you for your help.
Hi,
Rolling
, . , , , :
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
XSLT .
6k + 1th gallery. tr, gallery 5. ( "proc" ), , XSLT .
<xsl:template match="gallery[position() mod 6 = 1]">
<tr>
<xsl:apply-templates mode="proc"
select=".|following-sibling::gallery[not(position() > 5)]"
/>
</tr>
</xsl:template>
"proc" gallery 6, .
<xsl:template match="gallery" mode="proc">
<td>
<img src="{gallery-image-location}" alt="{gallery-image-alt}"/>
</td>
</xsl:template>
XSLT gallery, 6k + 1 ( 6-). - , "proc" .
<xsl:template match="gallery[not(position() mod 6 = 1)]"/>
</xsl:stylesheet>
XSLT, .