xsl-list
[Top] [All Lists]

Re: re-ordering an instance to match a schema

2003-05-14 13:49:23
Hi Simon,

At 02:32 PM 5/14/2003, you wrote:
Some of you might remember that I was writing a small suite of XSLT to do roundtripping of XML instance data to HTML forms and back again, based on RNG (relax NG) schemas to define the forms. Well, I actually made some progress and have something that kinda-sorta works now. One issue though is that my code isn't smart enough to insert new elements in the "right" order*.

* where the "right" order is the order that things appear in the schema

The reason that's important is that xslt I've seen (and written ...) often assumes that the instance XML will be in a certain order and outputs in that order too, so that in this case with resumes I get job history listed before the name and address ;-)

Is there XSLT out there, that I can use, that will take an instance and a schema and re-order the instance to match the schema? Does that make sense?

Two things that can help us answer this question:

1. Are we talking arbitrary RNG schemas, or some subset thereof?
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.)

Seeing a sample of input (in this case, both inputs) and desired output would, as always, be a big help.

Cheers,
Wendell

___&&__&_&___&_&__&&&__&_&__&__&&____&&_&___&__&_&&_____&__&__&&_____&_&&_
    "Thus I make my own use of the telegraph, without consulting
     the directors, like the sparrows, which I perceive use it
     extensively for a perch." -- Thoreau


XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list