|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Select entire XML doc
Hi Brian,
At 12:24 PM 3/4/2003, you wrote: Normally all I would want when doing a copy are elements. I didn't realize that you *can* copy all nodes in a source document, probably because there's little point in doing so since you would just create an exact copy of the source. Probably the commonest example in my experience is the technique of adapting an identity stylesheet to tweak a document only in places. Perhaps if you were copying multiple sources to the result tree and wanted everything, including the <?xml?> declaration--but then the result wouldn't be well-formed XML, correct? Yes -- with one tiny (but potentially important) caveat. The XML declaration <?xml version="1.0"?> is *not* a processing instruction, and is *not* present in the XPath data model. So in a document that starts: <?xml version="1.0" encoding="funkyencoding"?> <?xml-stylesheet href="myfunkyxform.xsl" type="text/xsl"?> the xml-stylesheet PI is available, but the XML declaration (which looks just like a PI) is not -- nor is the information stored in it (such as that this data purportedly started life in some funkyencoding). Why does the XML declaration look like a PI? (I hear you cry) if it's not? One answer: for backwards compatibility with older (SGML) parsers that would not complain on a PI, but would gag if handed a declaration they didn't recognize. (The usual XML declaration syntax being, in conformance to SGML practice, <!...> .) Once upon a time this was a very handy workaround; it's still occasionally useful sometimes (at the cost of terrible confusion to parser writers or programmers who want "the XML processing instruction"). Cheers, Wendell
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
|

Cart








