[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: re-ordering an instance to match a schema
Hi Wendell,
On Wednesday, May 14, 2003, at 04:49 PM, Wendell Piez wrote: Hi Simon, Ideally, any schema, assuming it's in XML format. The subset I've been working with so far seems to be those that terminate, I don't know the right word, but they don't allow infinite recursion of elements or infinitely large trees. 2. By "reorder the instance to match the schema", we are talking about the order declared by the schema to be a valid order, or the order of the declarations? (The former, I take it. But this is why the first question is important.) Actually the latter. I'm thinking about schemas where it will validate in bunch of orders, but where there is an author-implied order in the declarations. For example, if there's a <oneOrMore><choice>...</choice></oneOrMore> with a series of options, the implied order is the order the choices are written in the schema. Seeing a sample of input (in this case, both inputs) and desired output would, as always, be a big help. OK. At the end is schema snippet, then a valid instance snippet in an implicitly wrong order, then a valid instance snippet in an implicity right order according to order of declarations. simon ======== RNG schema snippet ========= <element name="contact"> <zeroOrMore> <choice> <element name="phone"> <optional> <attribute name="location"> <choice> <value> home </value> <value> work </value> <value> mobile </value> </choice> </attribute> </optional> <text /> </element> <element name="fax"> <optional> <attribute name="location"> <choice> <value> home </value> <value> work </value> </choice> </attribute> </optional> <text /> </element> <element name="pager"> <text /> </element> <element name="email"> <text /> </element> <element name="url"> <text /> </element> <element name="instantMessage"> <optional> <attribute name="service" /> </optional> <text /> </element> </choice> </zeroOrMore> </element> ======== implicitly wrong order (but valid) ========= <contact> <url>http://www.simonwoodside.com/<url> <email>sbwoodside@xxxxxxxxx</email> <phone location="work">555-1212</phone> <fax>555-1111</fax> </contact> ======== implicitly right order (also valid) ========= <contact> <phone location="work">555-1212</phone> <fax>555-1111</fax> <email>sbwoodside@xxxxxxxxx</email> <url>http://www.simonwoodside.com/<url> </contact>
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
|