XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Mattias PirmannSubject: Several attributes with the same name within the same element
Author: Mattias Pirmann
Date: 06 Apr 2006 10:01 AM
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

Posttop
Minollo I.Subject: Several attributes with the same name within the same element
Author: Minollo I.
Date: 06 Apr 2006 10:25 AM
This kind of questions are better asked on the xsl-list mailing list, which specializes in general-purpose XSLT issues.

See http://www.mulberrytech.com/xsl/xsl-list/

Minollo

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.