using XSLT to transform a XML recordset
I'm in the process of helping on of the s ystems guys with a little question on XLST, and we're wondering if something can be done. I have a recordset, extracted from a database, via some ASP (this is all in MS country), we make it into a xml object. for now, I've written the following, simple XML document: <?xml version="1.0"?> <data> <row bundle="svendtofte" reskey="description" resvalue="svends forsoeg paa xml transformations" /> <row bundle="svendtofte" reskey="title" resvalue="svends xml" /> <row bundle="svendtofte" reskey="text" resvalue="davs med dig" /> <row bundle="svendtofte" reskey="link" resvalue="et link til cnn" /> <row bundle="mikkel" reskey="de" resvalue="et link til cnn" /> <row bundle="mikkel" reskey="blah" resvalue="en value som svendtofte ikke har" /> </data> notice how, each bundle, being the main identifier, doesn't always have the same number of resources. the idea being, that we want the base to be flexible, so no set amount of values have been defined. Just that it always contains a reskey (resourcekey), and a resvalue (resourcevalue), and these properties/values are tied to a bundle name, in the above example, "svendtofte" and "mikkel". what we want is something like this: <?xml version="1.0"?> <data> <element bundle="svendtofte" description="svends forsoeg paa xml transformations" title="svends xml" text="davs med dig" link="et link til cnn" de="" blah=""/> <element bundle="mikkel" description="" title="" text="davs med dig" link="et link til cnn" de="et link til cnn" blah="en value som svendtofte ikke har"/> </data> that is, we need each "element", to [expletive deleted] the values it has associated (via the bundle), and all the attributes that are defined, anywhere in the recordset, we need to set on all elements. if a element does not have a value, for a set attribute, we need to set it to null, or something similar. now, before I start on all this (I have alot of work, and more coming), I just want your guess, if this is possible. The problem, as I see it, is that you need to go over the xml document twice, once to see what values we want, and a second time, to set them all. Any advice, or links or code will be greatly appreciated :) And a big hey to everybody on the list :) -svendtofte www.svendtofte.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
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