Re: insert with-option

Sure, "with-option" is just a dynamically evaluated form of putting
the options as attributes on the step tag.
I.e.
  p:insert match="Structure"
should be the same as
  p:insert
    p:with-option name="match" select="'Structure'"
The difference is that the value of a "with-option" is a dynamic XPath
expression, so you have to quote it as a string if you just want
something static.
-Leif

On 11/7/09, Bob Jolliffe <bobjolliffe@gmail.com> wrote:
> Thank you.  It does.  Silly of me!
>
> But I wonder am I interpreting with-option correctly here anyway?  ie should
> p:insert be able to take it's match and name options using with-option?
>
> Bob
>
> 2009/11/6 <Toman_Vojtech@emc.com>
>
>>  Hi,
>>
>> The following should work:
>>
>> <p:insert match="/msg:Structure" position="last-child"
>>     xmlns:msg="http://www.SDMX.org/resources/SDMXML/schemas/v2_0/message">
>>   ...
>> </p:insert>
>>
>> Regards,
>> Vojtech
>>
>>  ------------------------------
>> *From:* xproc-dev-request@w3.org [mailto:xproc-dev-request@w3.org] *On
>> Behalf Of *Bob Jolliffe
>> *Sent:* Monday, November 02, 2009 12:18 AM
>> *To:* xproc-dev@w3.org
>> *Subject:* p:insert with-option
>>
>> Hello.
>>
>> I have a problem doing something which I thought would be simple but its
>> proving quite tricky.
>>
>> I am trying to insert a fragment into an "envelope" like this:
>>
>>    <p:insert  match="/Structure" position="last-child">
>>
>>         <p:input port="source">
>>             <p:document href="./sdmx_message.xml"/>
>>
>>         </p:input>
>>
>>         <p:input port="insertion">
>>             <p:pipe port="source" step="sdmx_message"/>
>>         </p:input>
>>
>>     </p:insert>
>>
>> The problem is that Structure is defined in sdmx_message.xml as:
>> <Structure xmlns="
>> http://www.SDMX.org/resources/SDMXML/schemas/v2_0/message<http://www.sdmx.org/resources/SDMXML/schemas/v2_0/message>"
>> xmlns:structure="
>> http://www.SDMX.org/resources/SDMXML/schemas/v2_0/structure<http://www.sdmx.org/resources/SDMXML/schemas/v2_0/structure>"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
>> http://www.SDMX..org/resources/SDMXML/schemas/v2_0/message<http://www.sdmx.org/resources/SDMXML/schemas/v2_0/message>SDMXMessage.xsd">
>>
>> So I am struggling to match the namespace part of Structure.
>>
>> I thought I could rewrite the insert step as:
>>     <p:insert>
>>         <p:with-option name="match" select="/Structure"
>>             xmlns="
>> http://www.SDMX.org/resources/SDMXML/schemas/v2_0/message<http://www.sdmx.org/resources/SDMXML/schemas/v2_0/message>
>> "/>
>>         <p:with-option name="position" select="last-child"/>
>>         <p:input port="source">
>>             <p:document href="./sdmx_message.xml"/>
>>         </p:input>
>>
>>         <p:input port="insertion">
>>             <p:pipe port="source" step="sdmx_message"/>
>>         </p:input>
>>
>>     </p:insert>
>>
>> But it seems that the insert step won't accept match and position being
>> passed in this way using with-option (using calabash).
>>
>> Can anybody suggest (i) what I might be doing wrong and (ii) is there a
>> workaround which I can use?  For the moment I am replacing the insert step
>> with an xslt step but that does kind of ruin the simplicity of insertion.
>>
>> Regards
>> Bob
>>
>>
>

Received on Sunday, 8 November 2009 07:03:08 UTC