RE: Relax p:variable restrictions

> I am not sure about the need for rule 4, though. The moving of steps is
> an internal detail.

Well, that is not entirely true - at least the construction of the dependency graph is not. But still, for your example "invalid" pipeline:

  <p:variable name="ex:foo" select="1">
    <p:xpath-context><p:empty/></p:xpath-context>
  </p:variable>

  <p:identity name="one" ref="{$ex:foo}">
    <p:input port="source">
      <p:pipe step="two"/>
    </p:input>
  </p:identity>

  <p:variable name="ex:foo" select="2">
    <p:xpath-context><p:empty/></p:xpath-context>
  </p:variable>

  <p:identity name="two" ref="{$ex:foo}">
    <p:input port="source">
      <p:inline><doc/></p:inline>
    </p:input>
  </p:identity>

you will end up with a dependency graph that:

1. puts "one" after "two"
2. has no cycles

Which, depending on the implementation, can result in one of the following orderings:

ex:foo(1)
             ex:foo(2)
             two
one

----- 

             ex:foo(2)
ex:foo(1)
             two
one

-----

             ex:foo(2)
             two
ex:foo(1)
one

-----

Because the two ex:foo variables are two completely different variables (with the same name, but not depending on each other, directly or indirectly), all of the above orderings are perfectly fine.

Even the following pipeline, in which the second ex:foo depends on the first ex:foo is fine, IMHO:

  <p:variable name="ex:foo" select="1">
    <p:xpath-context><p:empty/></p:xpath-context>
  </p:variable>

  <p:identity name="one" ref="{$ex:foo}">
    <p:input port="source">
      <p:pipe step="two"/>
    </p:input>
  </p:identity>

  <p:variable name="ex:foo" select="$ex:foo+1">
    <p:xpath-context><p:empty/></p:xpath-context>
  </p:variable>

  <p:identity name="two" ref="{$ex:foo}">
    <p:input port="source">
      <p:inline><doc/></p:inline>
    </p:input>
  </p:identity>

Dependency graph:
1. puts the second "ex:foo" after the first
2. puts "one" after "two"
3. has no cycles

Results in ordering:

ex:foo(1)
             ex:foo(2)
             two
one


Regards,
Vojtech

--
Vojtech Toman
Consultant Software Engineer
EMC | Information Intelligence Group
vojtech.toman@emc.com
http://developer.emc.com/xmltech

Received on Tuesday, 1 October 2013 07:34:15 UTC