Proposal: replace here documents with a component

I wouldn't dream of removing the functionality of "here documents",
but there's a balance to be made between simplicity and functionality
and I think we've got it wrong with respect to here documents in the
current draft.

The fact that we have three ways to describe inputs, and the fact that
one of them (here documents) is very different from the other two
(attributes) makes the draft quite a bit more complicated.

It also imposes (unnecessary, IMHO) constraints on the design of the
language. Consider the current draft's position on "choose" as opposed
to "for-each". Because we put the context attributes directly on the
"choose" element, you can't use a here document for choose. Because we
used a "declare-input" for for-each, you can.

Bleh.

I propose a standard "p:document" component that has no inputs and
returns its content as a document instead.

Instead of writing:

  <p:step name="xform" type="xslt">
    <p:input port="document">
      <div xmlns="...">
        <p>some txt</p>
      </div>
    </p:input>
    <p:input port="stylesheet" href="something.xsl"/>
  </p:step>

you'd write:

  <p:document name="htmlfrag">
    <div xmlns="...">
      <p>some txt</p>
    </div>
  </p:document>

  <p:step name="xform" type="xslt">
    <p:input step="htmlfrag" port="result"/>
    <p:input port="stylesheet" href="something.xsl"/>
  </p:step>

I think that here documents are relatively uncommon and I don't think
this is a significant burden on authors.

It has two additional benefits:

1. The step is considerably shorter and simpler and, as a consequence,
   I think it's easier to understand.
2. The content of the here document becomes reusable.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh
XML Standards Architect
Sun Microsystems, Inc.

Received on Thursday, 21 September 2006 14:13:48 UTC