Thanks Wendell,
Your example is a fine way to break the table into rows, but I am still
left with the core problem:
How do I select a run of emptpy elements for processing into a table
with rows?
I.e. I have
<photo title="9 jo kesa with Sanskrit A" file="Daimonji.023.jpg"> This
robe was found in 1955 after ... end of description. </photo>
<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"/>
<photo title="9 jo kesa with Ring TieA" file="Daimonji.032.jpg"> Very
fine condition linen robe. The carved box ... end of description. </photo>
And I want to apply table processing to that central run of 6 elements,
making a table of one and a half rows of four each. The elements with
paragraphs of text are handled in a different way. I can select the
first empty <photo ../> element with
<xsl:template
match="photo[not(text())][preceding-sibling::photo[1][text()]]">
But how do I assign that and the following 5 elements to a variable,
with which I can then call the "rowsof4" template?
I think I want something like the following, but it fails with the
"wrong number of arguments".
<xsl:with-param name="nodes" select=". |
following-sibling::photo[not(text())][position()
<position(following-sibling::photo[text()][1])]"/>
Thanks,
David Riggs, Kyoto
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>
then...
<xsl:call-template name="rowsof4">
<xsl:with-param name="nodes"
select="$the-elements-you-want-in-your-rows]"/>
</xsl:call-template>
... leaving the rest (e.g. the "cell" mode) for you to fill in.
--------------------
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--