[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Dilemma: dot notation or attribute
[Autumn Cuellar] > I want to be able to import one document with > the root element <model> into another document with the same root > element and then access element content in the imported "model". We've > considered two ways of doing this. Several questions come to mind. 1) Do you really need to "import" the one into the other with the same root element? Or do you just need to get at the data in the second document in some way? 2) Do you expect some standard xml machinery to understand your intent in doing this "import", or do you plan to accomplish this entirely with your own code? 3) What does the second document look like? Or do you think you will need something much more generic than just specifying units? 4) How large will your files be? If your main interest is to use a collection of units that is stored in another file, that is one thing. If you are thinking of a general problem of merging two documents and then referring internally to the merged elements, that is something else again. Without knowing the answers to these questions, I would consider using an xslt transformation to wrap the second document in a new root element with its own namespace. Then you could combine the two, either with xslt (maybe in the same transformation) or by referring to it as an external entity. Alternatively you could import it and wrap it in its own element just by making it an external entity. However, before deciding how to proceed you need to work out how you plan to make use of the units information. Will the processor have to do anything with the units, or are they just there for people to read? Will you have to combine units programatically into new ones or not? If you may need to compose units, here is a link that may be useful: " Converting FITS into XML: Methods and Advantages" http://www.adass.org/adass/proceedings/adass00/P1-35/ Here is a message of mine from a fairly old thread on units: http://pioneer.gsfc.nasa.gov/xml/internal/mail/mhonarc/xml/msg00075.html Eventually, the work discussed in the thread developed as XDF: http://xml.gsfc.nasa.gov/XDF/ This is not exactly what you asked for, but it gives you some ideas to factor into your thinking. Another approach would be to use references to the units document. Something like this, perhaps: <model> <variable name="A" units="&example;#meter_per_cm2"/> </model> Here, &example; is declared to be "http://www.example.com/sample_model.xml". For this to work, the strategic elements in the second document need to be given their own ID attributes so that the "#" syntax can work. You could still use this basic approach even if you merged the second document into the first, but it will probably be better not to merge it physically. If there would only be a single other document, you moght consider using xsl:base to let you eliminate the "&example;" from the above. RDF would be another possibility, but I think the last example above will probably serve. Cheers, Tom P
|
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
|