[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Challenge
Didier PH Martin <martind@n...> writes: > d) The trick now is to relate some of the HTML elements to > some of the XML element. Not easy, but I'll persevere. I do this as follows: 1) Flatten the input XML using a 2nd transform so that there is no hierarchy (the XML request fields are a flat collection). This is placed in an XML DOM but not presented. (You can run any transform against any URI/XML DOM without necessarily presenting the results.) 2) Walk this new DOM, getting the appropriate request attributes and matching them against various validation templates as appropriate for the original object type. Eg; if I have <birthdate type="date" ...> I build an <input name="birthdate"...> etc. and I subsequently validate as appropriate. I have code at home (this wasn't done for a work project), but there's a small chance I might remember to send a copy here to work so I can post an example for you... The one thing that doesn't match up with your requirements is that I return the flattened XML instead of once more matching the results up against the original hierarchy. I wouldn't be too hard to run a third transform to take the matched element/value pairs and put them in their proper place...
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|