Re: [xsl] Re: Output validation with XSLT 2.0

Subject: Re: [xsl] Re: Output validation with XSLT 2.0
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Sat, 03 May 2008 12:41:41 -0400
At 2008-05-03 21:49 +0530, Mukul Gandhi wrote:
On 5/3/08, G. Ken Holman <gkholman@xxxxxxxxxxxxxxxxxxxx> wrote:
> Anyway, unused namespace declarations are innocuous in the result, so this
> is only an aesthetic issue.

I agree.

But the declaration, xmlns:xs="http://www.w3.org/2001/XMLSchema";
generated in the output XML is not being used anywhere (i.e., there is
no reference to the xs: prefix in the generated XML).

That is *your* problem, not the processor's problem. You added the namespace node to the result on the document element of the result ... what if 100 levels deep, 10 megabytes away from the start tag of the document element, you needed that namespace node to be in scope?


Shouldn't the processor be more intelligent to avoid generating any
namespace declarations which are used nowhere in the output?

By what criteria could that decision possibly be made?


Probably this could be a minor enhancement request for Saxon :)

I agree with Colin: enhancements shouldn't break conformance.


At 2008-05-03 21:57 +0530, Mukul Gandhi wrote:
I would like to learn how this could be non-compliant ...

Because the specification requires all attached namespace nodes to be copied to the result tree. Since you didn't prune the namespace node for XSD, it is still attached to the literal result element, so it must be copied.


And the specification cannot imply its removal or be changed to wait for your test of use: the result tree can be instantaneously serialized, which would include any attached namespace nodes. As soon as an element's content is begun, that element's start tag is allowed to be serialized to the output without keeping it around. Remember the result tree cannot be inspected. This allows an application not to keep the result tree in memory before serialization. Your "enhancement" would break so many aspects of implementation.

I hope this helps.

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

On 5/3/08, Colin Paul Adams <colin@xxxxxxxxxxxxxxxxxx> wrote:
> >>>>> "Mukul" == Mukul Gandhi <gandhi.mukul@xxxxxxxxx> writes:
>
>    Mukul> Probably this could be a minor enhancement request for
>    Mukul> Saxon :)
>
> I can't see Michael accepting it, as it would be non-compliant.


--
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds:     publicly-available developer resources and training
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread