How do I specify a dynamic value for href in p:store?

Hi Folks,

I have a juicers.xml document containing a sequence of <juicer> elements. 

I want to use p:foreach to iterate through each <juicer> element and p:store each <juicer> element into a different file, using the child <name> element concatenated with '.xml'

Here's my attempt at it:

<p:declare-step xmlns:p="http://www.w3.org/ns/xproc">

        <p:input port="source">
            <p:document href="juicers.xml"/>
        </p:input>
        <p:output port="result" sequence="true" />
    
    <p:for-each>
        <p:iteration-source select="//juicer"/>
        <p:output port="result"/>
        <p:identity name="juicer" />
        <p:store name="store">
            <p:with-option name="href" select="concat(name, '.xml')">
                <p:pipe step="juicer" port="result"/>
            </p:with-option>
        </p:store>
        <p:identity>
            <p:input port="source">
                <p:pipe step="store" port="result"/>
            </p:input>
        </p:identity>
    </p:for-each>

</p:declare-step>

The result I get is the last juicer, stored in a file ".xml"


Would someone please explain what I am doing wrong, and what is the correct approach?

/Roger

Received on Saturday, 17 January 2009 16:28:38 UTC