[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Select entire XML doc

Subject: RE: Select entire XML doc
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Tue, 04 Mar 2003 13:45:24 -0500
xml doc declaration
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


====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================


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



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.