Subject: [xsl] Re:Generating table rows... selecting a run of empty elements From: david <dariggs@xxxxxxxxxxxxxxx> Date: Fri, 11 Feb 2005 16:29:52 +0900 |
<photo title="hand bell from Hondo" file="Daimonji.024.jpg"/> <photo title="hand bell from Hondo" file="Daimonji.025.jpg"/> <photo title="hand bell from Hondo" file="Daimonji.026.jpg"/> <photo title="hand bell from Kaisando" file="Daimonji.027.jpg"/> <photo title="hand bell from Sanmon" file="Daimonji.028.jpg"/> <photo title="hand bell from Hondo" file="Daimonji.029.jpg"/>
Wendell answered my original query with: -------------------------- >>I understand how to select the elements with not(text()) and to use an >>Xpath expression to make a new row every >>four items, but I do not see how to select a run of content-less >>elements that need to be treated that way.
This is a pattern I've been using myself lately, to generate labels (effectively, same problem):
<xsl:template name="rowsof4"> <xsl:param name="nodes" select="/self::*"/> <!-- the default is a fancy way of saying 'no nodes' (by asking for the root node that is an element) --> <xsl:for-each select="$nodes"> <xsl:variable name="node-position" select="position()"/> <xsl:if test="$node-position mod 4 = 1"> <tr> <xsl:apply-templates mode="cell" select=". | $nodes[$node-position + 1] | $nodes[$node-position + 2] | $nodes[$node-position + 3]"/> </tr> </xsl:for-each> </xsl:template>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] document URI resolution., Morgan, Corey | Thread | Re: [xsl] Re:Generating table rows., Wendell Piez |
Re: [xsl] identify sections in an x, Dean Maslic | Date | Re: [xsl] Happy XML birthday, all! , Dimitre Novatchev |
Month |