Re: exclude-result-prefixes

Subject: Re: exclude-result-prefixes
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 07 Mar 2000 13:25:26 -0800
At 00/03/07 15:46 -0500, Barry Workman wrote:
can anyone supply some good working examples of the
"exclude-result-prefixes" attribute. Used in both an xsl:stylesheet element
and/or a literal result element. I have read both the spec and Cranes
examples and I still "don't get it" (Sorry Ken !).

I'm sorry the material didn't help you first time through.

Let me say a few things here, and let me know what it is that helps you understand so I can get it in the next edition of the book ... that way it will be in the update for all existing customers.

Hopefully, I can succinctly summarize it for you:

An XSLT processor is allowed to serialize the output with as many namespace declarations it thinks it is going to need. Doing so early on (say in the document element of the result) prevents the need to multiply declare the namespace when used lower down in the hierarchy.

It is an acceptable assumption by the processor that any namespace other than XSLT that is declared in the stylesheet is probably going to be needed somewhere in the result ... so XT will automatically emit a declaration in the result for each declaration found in the stylesheet.

Often, non-XSLT namespaces are used in stylesheets for XSLT named object identification, or embedded top-level documentation, or embedded data to be processed from the stylesheet, or other issues, so when these facilities are used the stylesheet writer has to declare the namespaces.

Hence, using these facilities could very easily produce declarations in the result that will *never* be used in the result.

The stylesheet writer can declare to the processor the intention that a namespace found in the stylesheet isn't going to be used in the result, and the processor will assume the writer is telling the truth and not emit a declaration unless it absolutely has to based on the need to serialize a particular result construct using the namespace. If the assertion was true, then the result ends up without the extraneous declarations indicated by the writer.

If something above makes it all make sense, let me know and I will add it to or highlight it in the book for the next edition and you will get your new copy announcement when it is ready.

A note for other customers: I value your feedback in order to improve the future editions, all of which you are entitled to receive. I would *prefer* receiving the notes in private so as to not reveal my faults, but I really don't mind getting them any way I can. The book has been enriched by receiving comments from existing customers.

I hope this helps.

................ Ken

G. Ken Holman                    mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.   
Box 266, Kars, Ontario CANADA K0A-2E0   +1(613)489-0999   (Fax:-0995)
Web site: XSL/XML/DSSSL/SGML services, training, libraries, products.
Practical Transformation Using XSLT and XPath      ISBN 1-894049-04-7
Next instructor-led training:               2000-05-11/12,2000-05-15,
-                                    2000-06-12,2000-06-13,2001-01-27

XSL-List info and archive:

Current Thread