|
Rank: Newbie
Joined: 2/27/2015 Posts: 6 Location: Geneva, CH
|
Hi altova users !
I'm looking for the best way to design a product list document (PDF Output), as shown on picture below :
I found this post https://www.altova.com/forum/default.aspx?g=posts&t=1420 that is quite close to my needs except that I would like 3 or 4 columns. I started with a left-to-right table but I don't know what param to use to set a max number of occurence per line.
Expected Layout with 4 columns :
Code: -------------- Catalog from DD.MM.YYYY ---------------
------------------------------------------------------------ | Product category A | ------------------------------------------------------------
------------- ------------- ------------- ------------- | Item #1 | | Item #2 | | Item #3 | | Item #4 | ------------- ------------- ------------- -------------
------------- ------------- ------------- | Item #5 | | Item #6 | | Item #7 | ------------- ------------- -------------
------------------------------------------------------------ | Product category B | ------------------------------------------------------------
------------- ------------- ------------- ------------- | Item #8 | | Item #9 | | Item #10| | Item #11| ------------- ------------- ------------- -------------
------------- | Item #12| -------------
Here is my data set :
Code: <?xml version="1.0" encoding="UTF-8"?> <catalog date="2017-04-02"> <category id="Confiserie"> <article id="71102" desc="AIRWAVES DISPLAY BOTTLES 40PC" img="../img/71102.jpg"/> <article id="71100" desc="AIRWAVES DISPLAY BOTTLES 72PC" img="../img/71100.jpg"/> <article id="71217" desc="BALISTO CORN-MIX 37G. NOVAE" img="../img/71217.jpg"/> <article id="71210" desc="BALISTO YOBERRY WHITE 37G PV" img="../img/71210.jpg"/> <article id="71231" desc="BRANCHE CAILLER LAIT L GRATUIT" img="../img/71231.jpg"/> <article id="71199" desc="BRANCHE CAILLER LAIT S 23G GR" img="../img/71199.jpg"/> <article id="71053" desc="BAZOOKA ORIGINAL & BLUE RAZZ" img="../img/71053.jpg"/> </category> <category id="Jeux-Jouets"> <article id="71245" desc="ANIMAUX FERME 10CM 6PC" img="../img/71245.jpg"/> <article id="71244" desc="ANIMAUX ZOO 10CM 6PC" img="../img/71244.jpg"/> <article id="71066" desc="POKEMON MINI CLASS.SUN&MOON 2" img="../img/71066.jpg"/> <article id="71248" desc="VEHICULE 4X4 FRICTION 17CM" img="../img/71248.jpg"/> <article id="71021" desc="VIGNETTE NOS P'TITS ANIMAUX" img="../img/71021.jpg"/> </category> </catalog>
I'm using StyleVision 2017 Enterprise, and I can't find any example with tables.. (columns with newspaper style is not applicable).
Any help will be appreciated :)
Regards, sly
|
|
Rank: Advanced Member
Joined: 2/27/2009 Posts: 565
|
Something like this is possible using XPath grouping. Basically, we want to group the articles into blocks of 4, and make one table per group.
MapForce offers a "group-into-blocks" function, so let's make a mapping which does that, and see what kind of grouping XPath it generates.
Code:<xsl:for-each-group select="article" group-adjacent="((fn:position() - xs:integer('1')) idiv xs:positiveInteger(xs:integer(xs:decimal('4'))))">
The example mapping (included in the zip archive below) ends up generating a group-adjacent attribute using a position-based XPath expression as you can see in the XSLT 2 code excerpt above, so we do the same kind of grouping on the "article" node template in our StyleVision design, though simplified to "( fn:position() - 1 ) idiv 4".
We create a table for the current-group node template, and make it grow left/right, and set the column width to 25%.
Obviously you could extend this by making the number of columns a parameter, and change the grouping XPath to divide by that instead of fixed "4" (and compute the column width as 100 divided by the number of columns), but I leave that to you.
Hope this helps.File Attachment(s): 2017-04-03, Product catalog layout.zip (10kb) downloaded 670 time(s).
|
|
Rank: Newbie
Joined: 2/27/2015 Posts: 6 Location: Geneva, CH
|
Hi K101
in one word : PERFECT !
Thank you very much for your reply with items attached, it's just great. Based on your design I will be able to provide buisiness teams with an example of what is possible through StyleVision ! I didn't know this MapForce feature, quite powerful !
Moreover, it hope that this case-study can help other designers.
Thank you once again
|
|
guest |