Re: Towards a consensus draft (urgent)

/ Murray Maloney <murray@muzmo.com> was heard to say:
| At 01:06 PM 9/10/2007 -0400, Norman Walsh wrote:
|>[...]
|>bearing in mind that namespace fixup says:
|>
|>    [Definition: Some steps can produce XML documents which have no
|>    direct serialization (because they include nodes with conflicting
|>    or missing namespace declarations, for example). To produce a
|>    serializable XML document, the XProc processor must sometimes add
|>    additional namespace nodes, perhaps even renaming prefixes, to
|>    satisfy the constraints of Namespaces in XML. This process is
|>    referred to as namespace fixup.]
|
| Can anyone produce a pipeline that exemplifies the process known as
| "namespace fixup"?

I'm not exactly sure what you mean, but consider this pipeline:

<p:pipeline name="main" xmlns:p="...">

<p:input port="source1">
  <p:inline>
    <ex:document xmlns:ex="http://example.com/ns/ex">
      <ex:chapter>
        <ex:title>Chapter title</ex:title>
      </ex:chapter>
    </ex:document>
  </p:inline>
</p:input>

<p:input port="source2">
  <p:inline>
    <my:document xmlns:my="http://example.com/ns/my">
      <my:placeholder/>
    </my:document>
  </p:inline>
</p:input>

<p:viewport match="in:placeholder"
            xmlns:in="http://example.com/ns/my">
  <p:viewport-source>
    <p:pipe step="main" port="source2">
  </p:viewport-source>
    
  <p:identity>
    <p:input port="source" select="/out:document/out:chapter"
             xmlns:in="http://example.com/ns/ex">
      <p:pipe step="main" port="source1"/>
    </p:input>
  </p:identity>
</p:viewport>

</p:pipeline>

What is the result of this pipeline? It's something like this:

<my:document xmlns:my="http://example.com/ns/my">
  <ex:chapter>
    <ex:title>Chapter title</ex:title>
  </ex:chapter>
</my:document>

Note in particular that the "ex:chapter" element, lifted out of its
original context, is still in the "http://example.com/ns/ex"
namespace. But we didn't copy any elements that had namespace
attributes which declared that the "ex" prefix was bound to that
namespace.

There's nothing wrong with this document, as an object model or
infoset. But there's no direct serialization of this document that you
can use to recreate it. You need to perform namespace fixup. For
example:

<my:document xmlns:my="http://example.com/ns/my">
  <ex:chapter xmlns:ex="http://example.com/ns/ex">
    <ex:title>Chapter title</ex:title>
  </ex:chapter>
</my:document>

This sort of thing can arise in various ways with a number of our
steps.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh <ndw@nwalsh.com> | It is important what a man still plans
http://nwalsh.com/            | at the end. It shows the measure of
                              | injustice in his death.--Elias Canetti

Received on Monday, 10 September 2007 20:03:48 UTC