W3C home > Mailing lists > Public > public-xml-processing-model-wg@w3.org > July 2006

For-each question

From: Norman Walsh <Norman.Walsh@Sun.COM>
Date: Fri, 21 Jul 2006 17:26:45 -0400
To: public-xml-processing-model-wg@w3.org
Message-ID: <87mzb21wfe.fsf_-_@nwalsh.com>
/ Jeni Tennison <jeni@jenitennison.com> was heard to say:
| I would much rather <p:choose> (and <p:for-each>) *weren't*
| self-contained, and could point to inputs from their ancestors.

What does it mean when a for-each points to inputs among its ancestors
and preceding siblings?

  <p:step kind="validate" name="valid">
    <p:input port="document" href="doc.xml"/>
    <p:input port="schema" href="doc.xsd"/>
    <p:output port="result"/>

  <p:step kind="transform" name="build-stylesheet">
    <p:input port="document" href="make-chapter-template.xsl"/>
    <p:input port="stylesheet" href="complete-template.xsl"/>
    <p:output port="result"/>

  <p:for-each select="//chapter" ref="#valid/result" name="loop">
    <p:declare-output port="result" name="chapter-docs"/>

    <p:step kind="transform" name="makehtml"/>
      <p:input port="document" ref="#loop/#matched"/>
      <!-- somehow we have to expose the matched regions as documents;
           here I'm imagining that for-each always declares a magically
           named input port which will be used for that purpose -->
      <p:input port="stylesheet" ref="#build-stylesheet/result"/>
      <p:output port="result" ref="#loop/chapter-docs"/>

  <p:step kind="tidy" name="tidy">
    <p:input port="document" ref="#loop/chapter-docs"/>

The transform inside the for-each will get run an arbitrary number of
times. Do reads from inside a for-each automatically get a copy of the
referenced input? I suppose they have to.

                                        Be seeing you,

Norman Walsh
XML Standards Architect
Sun Microsystems, Inc.

Received on Friday, 21 July 2006 21:26:55 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:32:40 UTC