Hi Jonathan, I've also used "ode:insert-as-last-into()" in a similar
case ant it works as good as expected.
My BPEL script:
<assign>
<copy>
<from>
<literal>
<s0_tns:BookSearchResponse />
</literal>
</from>
<to>$output0.body</to>
</copy>
</assign>
<assign>
<copy>
<from>
<literal>
<s0_tns:result >
<s0_tns:title >
</s0_tns:title>
<s0_tns:author >
</s0_tns:author>
<s0_tns:publishDate >
</s0_tns:publishDate>
<s0_tns:amazonRank >
</s0_tns:amazonRank>
</s0_tns:result>
</literal>
</from>
<to variable='_elem1'/>
</copy>
</assign>
<forEach counterName='_i5' parallel='no'>
<startCounterValue>1</startCounterValue>
<finalCounterValue>count($_ds1/inner:record)</finalCounterValue>
<scope>
<assign>
<copy>
<from
expressionLanguage='urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0'>ode:insert-as-last-into($output0.body,
$_elem1)</from>
<to>$output0.body</to>
</copy>
</assign>
</scope>
</forEach>
And the WSDL pieces:
<element name="searchBookResponse">
<complexType>
<sequence>
<element maxOccurs="unbounded"
minOccurs="0" name="result">
<complexType>
<sequence>
<element name="amazonRank" type="nonNegativeInteger"/>
<element name="price" type="string"/>
<element name="publishDate" type="date"/>
<element name="title" type="string"/>
<element name="publisher" type="string"/>
<element name="detailUrl" type="anyURI"/>
<element name="author" type="string" maxOccurs="unbounded"/>
</sequence>
</complexType>
</element>
</sequence>
</complexType>
</element>
</schema>
</types>
<message name="searchBookOutput">
<part element="tns:searchBookResponse" name="body"/>
</message>
Hope it useful to you.
Regards
Wenfeng
-------------------
http://www.bupt.edu.cn
On Fri, Apr 17, 2009 at 3:36 AM, Jonathan Coogan
<[email protected]> wrote:
> Hi. I have a question about the "insert-as-first-into" and
> "insert-as-last-into" Xpath extensions.
>
> I get a selectionFailure if I try to insert a child into a parent that
> does not yet contain other children. I'm wondering if this was done on
> purpose for some reason, or if this is a bug.
>
> As an example, say I have the following elements/types:
>
> <element name="RecordSet" type="tns:RecordSetType"/>
> <complexType name="RecordSetType">
> <sequence>
> <element maxOccurs="unbounded" minOccurs="0"
> ref="tns:Record"/>
> </sequence>
> </complexType>
>
> <element name="Record" type="tns:RecordType"/>
> <complexType name="RecordType">
> <sequence>
> <element maxOccurs="1" minOccurs="1" name="SomeValue"
> type="string"/>
> <element maxOccurs="1" minOccurs="1" name="AnotherValue"
> type="string"/>
> </sequence>
> </complexType>
>
> So RecordSet can contain 0 or more Records. If I try to insert a Record
> into an empty RecordSet (0 Records) I get a selectionFailure. I have to
> initialize the RecordSet variable with at least one dummy Record before
> it will work.
>
> Comments?
>
> Thanks.
> -Jon
>