- From: Norman Walsh <ndw@nwalsh.com>
- Date: Wed, 17 Sep 2008 07:15:20 -0400
- To: public-xml-processing-model-wg@w3.org
- Message-ID: <m2abe7f2gn.fsf@nwalsh.com>
"Innovimax SARL" <innovimax@gmail.com> writes:
> I have still trouble to fully understand the code fragment provided as
> sample in the spec
>
> Especially this one
>
> [[
> <p:pipeline type="ex:delete-in-div"
> xmlns:p="http://www.w3.org/ns/xproc"
> xmlns:ex="http://example.org/ns/ex"
> xmlns:h="http://www.w3.org/1999/xhtml">
> <p:option name="divchild" required="true"/>
>
> <p:delete>
> <p:with-option name="match" select="concat('h:div/',$divchild)">
> <p:namespaces xmlns:h="http://www.w3.org/1999/xhtml"
> xmlns:html="http://www.w3.org/1999/xhtml"/>
> </p:with-option>
> </p:delete>
>
> </p:pipeline>
> ]]
>
> In my understanding, the binding of the prefix "h" has been done on
> p:pipeline element, so we don't need to recall the binding on
> p:namespaces element, do we ?
No, I suppose not, since it's already in-scope. But it's not wrong
to put it there and it does make the intent explicit. Still, it might
mislead someone into thinking that p:namespaces uses only the *declared*
namespaces not the in-scope ones, so I'll remove xmlns:h.
> Furthermore again by the same rule ("Otherwise, the in-scope
> namespaces from the element providing the value are used."), we can
> completely get rid of p:namespaces in this case
>
> <p:delete>
> <p:with-option name="match" select="concat('h:div/',$divchild)"
> xmlns:html="http://www.w3.org/1999/xhtml"/>
> </p:delete>
>
> Am I right ?
Yes, you could do that. This example is really just a setup ("here's
how you *could* do it") for the next example ("here's how you *should*
do it").
On further reflection, I'm happy with these examples as they stand.
However, I'll add a note to point out that it's not strictly
necessary.
> Hence we got also
> [[
> <?xml version='1.0'?>
> <p:pipeline type="ex:delete-in-div"
> xmlns:p="http://www.w3.org/ns/xproc"
> xmlns:ex="http://example.org/ns/ex"
> xmlns:h="http://www.w3.org/1999/xhtml">
> <p:option name="divchild" required="true"/>
>
> <p:delete>
> <p:with-option name="match" select="concat('h:div/',$divchild)">
> <p:namespaces binding="divchild"/><!-- this one makes full sense for me -->
Here you *do* need the second p:namespaces element with the xmlns:h binding.
Otherwise you won't have one because:
If a p:variable, p:with-option or p:with-param includes one or more
p:namespaces elements, then the union of all the namespaces
specified on those elements are used as the bindings for the
variable, option or parameter value. In this case, the in-scope
namespaces on the p:variable, p:with-option or p:with-param are
ignored.
and
If the binding attribute is specified, it must contain the name of a
single in-scope binding. The namespace bindings associated with that
binding are used.
Since divchild is specified in a context where xmlns:h isn't bound, it wouldn't
otherwise be bound.
> </p:with-option>
> </p:delete>
>
> </p:pipeline>
> ]]
I've made a few editorial corrections, please let us know if you're
unsatisfied with the result.
Be seeing you,
norm
--
Norman Walsh <ndw@nwalsh.com> | The richness of life lies in memories
http://nwalsh.com/ | we have forgotten.--Cesare Pavese
Received on Wednesday, 17 September 2008 11:16:22 UTC