xsl-list
[Top] [All Lists]

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

2006-03-09 06:19:07
Tsk, tsk, tsk. 

1) The data document isn't well-formed.

<optionList1>
 <option>1</option>
 <option>2</option>
</List1>

Note the opening tag doesn't match the closing tag, therefor this isn't XML.
Now, correcting this, I moved on to the XSLT and found that what it's trying to 
output isn't HTML:

<xsl:for-each select="//enquiry-data/free-xml/optionList1/*">
<xsl:value-of select="."/></a><br/>
</xsl:for-each>

Note the closing </a> doesn't have a matching opener (<a>).

Now how about an example output of what you want to get from the 
transformation, or at least, tell us whether each <optionListx> should produce 
a row in the output or should it produce a column in which case the <option> 
elements with matching positions relative to it's siblings make up the 
successive <td> elements in the output. (This last sentence is why I recommend 
example output rather than descriptions of the desired output.)

And here's another piece of advice. If you have any control over the XML 
format, immediately kill the idea that each <optionListx> element should have a 
unique name. If you need to differentiate them, use an attribute. So ...

<optionList1> becomes <optionList id="1">
<optionList2> becomes <optionList id="2">
<optionList3> becomes <optionList id="3">

This will make writing and maintaining a stylesheet much easier.

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

<Prev in Thread] Current Thread [Next in Thread>
  • RE: [xsl] FW: XSL processes XML incorrectly when uneven number of values returned in array elements, cknell <=