xsl-list
[Top] [All Lists]

[xsl] Maximum columns in a table

2006-04-06 04:02:40
Hi!

I m very new to XSLT and have only worked with simple tables. Now I have 
problem I hope someone can help me with. 

I have two different kinds of attributes, cart and unit, which should be 
presented in two tables depending on if the element only holds cart or cart and 
unit.

The table that only holds attribute cart should present the values in a table 
of 5 columns. If it has more than 5 values it should create a new row i.e. 50 
values should be presented in a table of 10 rows with 5 columns. 

The table that holds both cart and units should be presented in a table of 5 
columns. The first column should hold cart and column 2-5 unit. If more than 4 
units exist it should be put on row 2 starting in column 2.

Should I create two elements, one that only holds cart and one that holds cart 
with units or stick with one? How can I make the maximum number of columns and 
also specify on which column to start on in the next row.


Below is the three conditions

Only carts - 5 columns in each row                                              
                                                 

2174123434567  2174123445677 2174123434567 2174123434567  2174123434567
2174123434567  2174123434567 2174123434567 2174123434567  2174123434567         
                                                                      

If cart and unit exist

2174123434567 sczu111222-6  xscu222333-5 scxu333444-5 xcsu444333-5              
                                                                                
        
                                                                         
If more than 4 units per cart

2174123434567 sczu111222-6  xscu222333-5 scxu333444-5 xcsu444333-5
              xscu222333-5  scxu333444-5 xcsu444333-5 sczu111222-6
2174123434567 sczu111222-6  xscu222333-5 scxu333444-5 xcsu444333-5
              sczu111222-6  xscu222333-5 scxu333444-5 xcsu444333-5


XML code

1 element - cartinfo

<?xml version="1.0" encoding="ISO-8859-1"?>

<general>
 <cartinfo>
  <cart>1174123434567</cart>
 </cartinfo>
 ........
 <cartinfo>
  <cart>1174123434567</cart>
  <unit>xscu222333-5</unit>
  <unit>xscu222333-5</unit>
  <unit>xscu222333-5</unit>
  <unit>xscu222333-5</unit>
 </cartinfo>
 ........
</general>

2 elements - cartinfo and cartunitinfo

<?xml version="1.0" encoding="ISO-8859-1"?>

<general>
 <cartinfo>
  <cart>1174123434567</cart>
 </cartinfo>
 ..........
 <cartunitinfo>
  <cart>1174123434567</cart>
  <unit>xscu222333-5</unit>
  <unit>xscu222333-5</unit>
  <unit>xscu222333-5</unit>
  <unit>xscu222333-5</unit>
 </cartunitinfo>
 ............
</general>


Regards

Mattias









--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>
  • [xsl] Maximum columns in a table, Mattias Pirmann <=