[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: FW: XSL processes XML incorrectly when uneven num

Subject: RE: FW: XSL processes XML incorrectly when uneven number of values returned in array elements
From: cknell@xxxxxxxxxx
Date: Thu, 09 Mar 2006 08:18:42 -0500
optionlist id
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@xxxxxxxxxx - email

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.