[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: Limiting a row to four items
Hi Gerrit,
(responding to both emails)
No, XSLTB 2.
B Its just I have forgotten so much. It is not clear to me where in the
code I create the row.B I will try:
For each ...
B B B new row
B B B B B B four plates dealt with
B B B 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.imsieke@xxxxxxxxx
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@xxxxxxxxxxxx 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 {
B B width: 100%;
B B display: flex;
B B flex-direction: row;
B B justify-content: center;
}
My input XML is a long list of <stamp> elements with <plate> children.
....
<stamp >
B B B B B B B B B B B B B B B B <plate number="1"/>
B B B B B B B B B B B B B B B B <plate number="2"/>
B B B B B B B B B B B B B B B B <plate number="3"/>
B B B B B B B B B B B B B B B B <plate number="4"/>
B B B B B B B B B B B B B B B B <plate number="5"/>
B B B B B B B B B B B B B B B B <plate number="6"/>
B B B B B B B B B B B B B B B B <plate number="7"/>
B B B B B B B B B B B B B B B B <plate number="8"/>
</stamp>
....
and my XSLT dealing with this withinB <xsl:template match="stamp"> is:
<div class="row">
B B B B B B B <xsl:for-each select="plate">
B B B B B B B B B B B B B B <div class="block">
B B B B B B B B B B B B B B B B B B B B B B B B B B B B <aB
href="{concat('plates/', @number,
'.jpg')}">
B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B <img
class="large"
src="{concat('plates/',@number, 't.jpg')}"/>
B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B </a>
B B B B B B B B B B B B B B B </div>
B B B B B B B B B </xsl:for-each>
B B </div>
Works fine for four or fewer <plate> elements, but more than that
makes a mess
Any help appreciated,
Mark
|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
RSS 2.0 |
|
Atom 0.3 |
|
|