xsl-list
[Top] [All Lists]

RE: [xsl]: XSL processes XML incorrectly when uneven number of values returned in array elements

2006-03-10 06:14:51
Please disregard. I got confused for a moment. I'll get back soon.
-- 
Charles Knell
cknell(_at_)onebox(_dot_)com - email



-----Original Message-----
From:     cknell(_at_)onebox(_dot_)com
Sent:     Fri, 10 Mar 2006 08:07:42 -0500
To:       xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject:  RE: [xsl]:  XSL processes XML incorrectly when uneven number of 
values returned in array elements

Is there a maximum number of <option> children in an <optionListx> element, or 
could there be an indefinite number of columns in the output table?

We've already determined that there should be exactly seven rows (one for each 
<optionListx> element). The task becomes very easy if there is a maximum number 
of columns and very tricky if the number of columns is indeterminate.

Please advise.
-- 
Charles Knell
cknell(_at_)onebox(_dot_)com - email



-----Original Message-----
From:     Cave, Neil <Neil(_dot_)Cave(_at_)softwareag(_dot_)com>
Sent:     Fri, 10 Mar 2006 13:44:53 +0100
To:       <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Subject:  RE: [xsl]:  XSL processes XML incorrectly when uneven number of 
values returned in array elements

Hi Charles

I can try give it a go with 2.0

Alternatively, if I absolutely have to, I can modify the XSL that
transforms the XML from the back-end application to the XML required by
the front-end app. The front-end app requires data in the
free-xml/optionList/option format. 
However, the front-end app will accept the data as attributes or
elements.

I went with elements because I could not figure out how to map the
elements of the XML from the back-end app to the attributes of the
front-end XML using my XSL tool.

I had some XSL that displayed the data correctly when I used a test XML
document where the data was returned as attributes as in the structure
below.  

<free-xml>
<optionList1>
 <option desc="92" value="1"/>
 <option desc="101" value="2"/>
</optionList1>
Etc...

However, because of my limited XSL skills I could only create the
integration XSL (using a tool) that returns the back-end data as
elements
<free-xml>
<optionList1>
 <option>92</option>
 <option>101</option>
</optionList1>
Etc...

But now I sit with this display issue...

From what you say it might make more sense to get the XSL to return the
values as XML attributes with an enumerator attribute (value).

However then I will need to find out how to do this using TIBCO
XMLTransform or (my biggest fear) - by coding it myself.

-----Original Message-----
From: cknell(_at_)onebox(_dot_)com [mailto:cknell(_at_)onebox(_dot_)com] 
Sent: 10 March 2006 02:14 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl]: XSL processes XML incorrectly when uneven number of
values returned in array elements

e) In a given row, the successive <td> elements should contain the
values of one <option> element from each successive <optionListx> such
that the first row would contain optionList1/option[1],
optionList2/option[1], optionList3/option[1], optionList4/option[1],
optionList5/option[1], optionList6/option[1], optionList7/option[1].

if numbered from [1] correct, some people say [0] is the first
occurrence. But you are correct.
======================================== Answer: "some people" don't understand 
that in XPath, the counting
starts at 1, not zero.


f) At the point where optionListx/option[y] would return a null value,
an empty <td> should be emitted by the stylesheet.

Is this correct?

this is where it gets tricky. For example in optionList2 there are 10
occurrences, the first 8 have values, then 9 is a null and 10 has a
value. I need to display occurrence 9 as a blank, so that occurrence 10
is displayed in row 10. Null elements that come after the actual data
are trimmed by the application sending the XML.
======================================== Answer: This is may be tricky or very 
tricky. Can you use XSLT 2.0 or
are you stuck with 1.0?


--
Charles Kell
cknell(_at_)onebox(_dot_)com - email



-----Original Message-----
From:     Cave, Neil <Neil(_dot_)Cave(_at_)softwareag(_dot_)com>
Sent:     Fri, 10 Mar 2006 08:59:26 +0100
To:       <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Subject:  RE: RE: RE: RE: [xsl] FW:  XSL processes XML incorrectly when
uneven number of values returned in array elements

Hi Charles... 

a) There are seven <optionListx> elements, where "x" represents a digit
from 1 through 7. Are there always exactly seven <optionListx> elements?

correct

b) Each <optionListx> contains zero or more <option> child elements
with no guarantee as to the number of <option> elements in each.

correct

c) The number of rows in the output table will the the the same as the
number of <option> elements in the <optionListx> with the largest number
of <option> child elments.

correct

d) A row should have as many <td> elements as there are <optionListx>
elements.

correct



Each successive row would vary in that the number in the square brackets
"[]" would increment by one.

correct










-----Original Message-----
From:     Cave, Neil <Neil(_dot_)Cave(_at_)softwareag(_dot_)com>
Sent:     Thu, 9 Mar 2006 16:01:57 +0100
To:       <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Subject:  RE: RE: RE: [xsl] FW:  XSL processes XML incorrectly when
uneven number of values returned in array elements

Hi Charles, thanks for having a look at this for me.

Each optionList/option should be in a unique row.
That row should match the occurrence of the option element under
optionList*/

So if there is a value in the first occurrence of optionList*/ then it
should be displayed in row 1

If you look at the XML under /free-xml you see that optionList1 has 7
array values starting from the first occurrence of optionList1/option.

optionList2 has 10 with a Null value in occurrence 9.

When I apply the stylesheet the display shows the first occurrence of
optionList1 starting from row 3, whereas optionList2 starts from row one
(i.e. matching the occurrence in the XML).

Each unique optionList is the source of a new column (7 in total), and
each occurrence of option within each optionList is the source of a new
row.

The first occurrence of all optionList/options should be on row one.

Do this possibly make more sense?
 

-----Original Message-----
From: cknell(_at_)onebox(_dot_)com [mailto:cknell(_at_)onebox(_dot_)com] 
Sent: 09 March 2006 04:47 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: RE: RE: [xsl] FW: XSL processes XML incorrectly when uneven
number of values returned in array elements

Now, I've looked over the relevant part of the stylesheet and I'm still
confused as to what element in the data file should be the source of a
new row and what element should be the source of a new table division.
Can you shed some light on this?
--
Charles Knell
cknell(_at_)onebox(_dot_)com - email



-----Original Message-----
From:     Cave, Neil <Neil(_dot_)Cave(_at_)softwareag(_dot_)com>
Sent:     Thu, 9 Mar 2006 15:28:06 +0100
To:       <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Subject:  RE: RE: [xsl] FW:  XSL processes XML incorrectly when uneven
number of values returned in array elements

That is correct...

My apologies for flooding the list with eXcessML 

-----Original Message-----
From: cknell(_at_)onebox(_dot_)com [mailto:cknell(_at_)onebox(_dot_)com] 
Sent: 09 March 2006 04:26 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: RE: [xsl] FW: XSL processes XML incorrectly when uneven
number of values returned in array elements

Actually, Neil, I only really wanted the part of the document that's
causing the problem. After looking over the input, I have made the
hypothesis that the part of the transformation that's troubling you is
the <free-xml> element and its children, is that correct?
--
Charles Knell
cknell(_at_)onebox(_dot_)com - email



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


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




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


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




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


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




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


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




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




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