Re: Catching an XD0029

I solved my problem by using p:http-request instead:


<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" xmlns:c="
http://www.w3.org/ns/xproc-step"
    version="1.0">
    <p:input port="source"/>
    <p:output port="result"/>

    <p:try>
        <p:group>
            <p:identity>
                <p:input port="source">
                    <p:inline>
                        <c:request method="GET" detailed="true"
override-content-type="text/html; charset=utf-8"/>
                    </p:inline>
                </p:input>
            </p:identity>
            <p:add-attribute match="c:request" attribute-name="href">
                <p:with-option name="attribute-value"
select="'doesNotExist'"/>
            </p:add-attribute>
            <p:http-request/>
        </p:group>
        <p:catch>
            <p:identity>
                <p:input port="source">
                    <p:inline>
                        <error/>
                    </p:inline>
                </p:input>
            </p:identity>
        </p:catch>
    </p:try>

</p:declare-step>


However, it's still strange that p:data wouldn't work...

Regards
Jostein

2010/12/9 Jostein Austvik Jacobsen <josteinaj@gmail.com>

> Well, the p:data can't stand by itself. However if I put it in a
> p:variable, it's actually caught:
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
>     xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0">
>     <p:input port="source"/>
>     <p:output port="result"/>
>
>     <p:try>
>         <p:group>
>             <p:variable name="foo" select=".">
>                 <p:data href="doesNotExist"/>
>             </p:variable>
>             <p:identity>
>                 <p:input port="source">
>                     <p:inline>
>                         <ok/>
>                     </p:inline>
>                 </p:input>
>             </p:identity>
>         </p:group>
>         <p:catch>
>             <p:identity>
>                 <p:input port="source">
>                     <p:inline>
>                         <error/>
>                     </p:inline>
>                 </p:input>
>             </p:identity>
>         </p:catch>
>     </p:try>
>
> </p:declare-step>
>
>
> Regards
> Jostein
>
> 2010/12/9 Stefanie Haupt <st.haupt@gmail.com>
>
> Hi,
>> I'm just guessing here, but I think it's because you wrapped it into an
>> p:identity step. I'd try without and re-run.
>>
>> Regards,
>> Stefanie
>>
>>
>> On Thu, Dec 9, 2010 at 10:49 AM, Jostein Austvik Jacobsen <
>> josteinaj@gmail.com> wrote:
>>
>>> Hi.
>>>
>>> I'm having a problem catching the XD0029 dynamic error thrown from a
>>> p:data where the referenced file does not exist. I'm using oXygen 12.0 with
>>> the bundled Calabash. Here's the pipeline:
>>>
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
>>>     xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0">
>>>     <p:input port="source"/>
>>>     <p:output port="result"/>
>>>
>>>     <p:try>
>>>         <p:group>
>>>             <p:identity>
>>>                 <p:input port="source">
>>>                     <p:data href="doesNotExist"/>
>>>                 </p:input>
>>>             </p:identity>
>>>         </p:group>
>>>         <p:catch>
>>>             <p:identity>
>>>                 <p:input port="source">
>>>                     <p:inline>
>>>                         <c:data/>
>>>                     </p:inline>
>>>                 </p:input>
>>>             </p:identity>
>>>         </p:catch>
>>>     </p:try>
>>>
>>> </p:declare-step>
>>>
>>>
>>> "err:XD0029 : XProc error err:XD0029 It is a dynamic error if the
>>> document referenced by a p:data element does not exist, cannot be accessed,
>>> or cannot be encoded as specified. /my/local/filesystem/path/doesNotExist
>>> (No such file or directory)"
>>>
>>> How come the p:try doesn't catch this error?
>>>
>>> Regards
>>> Jostein
>>>
>>
>>
>>
>> --
>> Stefanie Haupt, M.A.
>>
>>
>

Received on Thursday, 9 December 2010 11:25:06 UTC