Success!
(once I remembered to deal with the current-group.)
Thanks. After 2 am here and I have been trying to do this for hours. Bed
time!
Mark
On 8/28/2020 2:04 AM, Mark Wilson mark(_at_)knihtisk(_dot_)org wrote:
Hi Gerrit,
(responding to both emails)
No, XSLT 2.
Its just I have forgotten so much. It is not clear to me where in the
code I create the row. I will try:
For each ...
new row
four plates dealt with
end row
</xsl for each ?
I have never worked with flex before, so I am a bit sketchy.
Thanks for the quick answer.
Mark
On 8/28/2020 1:53 AM, Imsieke, Gerrit, le-tex gerrit(_dot_)imsieke(_at_)le-tex(_dot_)de
wrote:
Are you looking for an XSLT 1 solution?
In XSLT 2 or 3, you can do, when in stamp context:
<xsl:for-each-group select="plate" group-adjacent="(@number - 1) idiv
4">, and create a row for each group.
If you tune the .block width so that 4 of them fit into a .row, you
can also set flex-wrap:wrap in .row, then you need not create div.row
at all.
Gerrit
On 28.08.2020 10:44, Mark Wilson mark(_at_)knihtisk(_dot_)org wrote:
This is likely in the archives but I have forgotten how to use them.
Among the other things I have forgotten since I turned 80 is how to
a put set of elements into rows for HTML output. I want to put what
four <plate> elements conjure into each row; the number of< plate>
elements in each <stamp> element varies. The <plate> element
references the identity of a jpeg that will be put on the page. I
want four jpegs in each row.
my css is:
.row {
width: 100%;
display: flex;
flex-direction: row;
justify-content: center;
}
My input XML is a long list of <stamp> elements with <plate> children.
....
<stamp >
<plate number="1"/>
<plate number="2"/>
<plate number="3"/>
<plate number="4"/>
<plate number="5"/>
<plate number="6"/>
<plate number="7"/>
<plate number="8"/>
</stamp>
....
and my XSLT dealing with this within <xsl:template match="stamp"> is:
<div class="row">
<xsl:for-each select="plate">
<div class="block">
<a href="{concat('plates/', @number,
'.jpg')}">
<img class="large"
src="{concat('plates/',@number, 't.jpg')}"/>
</a>
</div>
</xsl:for-each>
</div>
Works fine for four or fewer <plate> elements, but more than that
makes a mess
Any help appreciated,
Mark
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--