1

I'm trying to run the following xproc code which involves sequence of xslt steps in pipeline. However the Calabash is not able to read or get the source document although the 'href' link is clearly mentioned.

The following error is reported in oXygen editor:

E [Calabash XProc] "Either a source document or an initial template must be specified"

The following error is seen when running the calabash from console:

Mai 07, 2013 2:41:52 PM com.xmlcalabash.util.DefaultXProcMessageListener error SEVERE: err:XD0011:XProc error err:XD0011 Mai 07, 2013 2:41:52 PM com.xmlcalabash.drivers.Main error SEVERE: It is a dynamic error if the resource referenced by a p:document element does not exist, cannot be accessed, or is not a well-formed XML document. Mai 07, 2013 2:41:52 PM com.xmlcalabash.drivers.Main error SEVERE: Underlying exception: net.sf.saxon.s9api.SaxonApiException: I/O error re ported by XML parser processing C:stlConversionxprocstlxml.xpl: C:stlConversionx procstlxml.xpl (Das System kann die angegebene Datei nicht finden)

Can someone please help me with this error?

Heres my xproc code:



<p:output port="result" sequence="true">  
    <p:pipe step="pre-run" port="result"/>
    <p:pipe step="normalize-stl-xml" port="result"/>
    <p:pipe step="tf-transform" port="result"/>
    <p:pipe step="transformARDOnline" port="result"/>
    <p:pipe step="filterUnusedStyleLayout" port="result"/>
</p:output>

<p:xslt name="pre-run">
    <p:input port="source">
        <p:document href="file:/C:/stlConversion/temp/a.xml"/>
    </p:input>
    <p:input port="stylesheet">  
        <p:document href="file:/C:/stlConversion/xslt/test.xsl"/> 
    </p:input>  
    <p:input port="parameters">  
        <p:empty/> 
    </p:input>
</p:xslt>

<p:xslt name="normalize-stl-xml">
    <p:input port="source">  
        <p:pipe step="pre-run" port="result"/>
    </p:input>  
    <p:input port="stylesheet">  
        <p:document href="file:/C:/stlConversion/xslt/normalize_stl_xml.xsl"/> 
    </p:input>  
    <p:input port="parameters">  
        <p:empty/> 
    </p:input>
</p:xslt>

<p:xslt name="tf-transform">
    <p:input port="source">  
        <p:pipe step="normalize-stl-xml" port="result"/>
    </p:input>  
    <p:input port="stylesheet">  
        <p:document href="file:/C:/stlConversion/xslt/tf_test_transform.xsl"/> 
    </p:input>  
    <p:input port="parameters">  
        <p:empty/> 
    </p:input>
</p:xslt>

<p:xslt name="transformARDOnline">
    <p:input port="source">  
        <p:pipe step="tf-transform" port="result"/>
    </p:input>  
    <p:input port="stylesheet">  
        <p:document href="file:/C:/stlConversion/xslt/transformARDOnline.xslt"/> 
    </p:input>  
    <p:input port="parameters">  
        <p:empty/> 
    </p:input>
</p:xslt>

<p:xslt name="filterUnusedStyleLayout">
    <p:input port="source">  
        <p:pipe step="transformARDOnline" port="result"/>
    </p:input>  
    <p:input port="stylesheet">  
        <p:document href="file:/C:/stlConversion/xslt/filterUnusedStyleLayout.xslt"/> 
    </p:input>  
    <p:input port="parameters">  
        <p:empty/> 
    </p:input>
</p:xslt>

<p:store href="file:/C:/stlConversion/ebu-tt_ard_online.xml" media-type="text/xml"/>

sharkbait
  • 2,980
  • 16
  • 51
  • 89
gops
  • 13
  • 5

1 Answers1

0

There are TWO different error messages happening..

Cannot find file..
The latter simply indicated that Calabash is unable to read the .xpl file itself. The error message mentions a filepath that seems to be lacking directory separators. Perhaps something went wrong with the initial call to Calabash.

This is the error message I get when I missspell the name of the .xpl:

D:\Projecten\Persoonlijk\XProc\stack8>calabash testt.xpl
mei 07, 2013 8:16:57 PM com.xmlcalabash.util.DefaultXProcMessageListener error
SEVERE: err:XD0011:XProc error err:XD0011
mei 07, 2013 8:16:57 PM com.xmlcalabash.drivers.Main error
SEVERE: It is a dynamic error if the resource referenced by a p:document element does not exist, cannot be accessed, or is not a well-formed XML document.
mei 07, 2013 8:16:57 PM com.xmlcalabash.drivers.Main error
SEVERE: Underlying exception: net.sf.saxon.s9api.SaxonApiException: I/O error reported by XML parser processing file:/D:/Projecten/Persoonlijk/XProc/stack8/test
t.xpl: D:\Projecten\Persoonlijk\XProc\stack8\testt.xpl (The system cannot find the file specified)

Source document must be specified
The first message is a bit misguiding though. It sounds like you forgot to bind input to an input port, but that is not the case. It is actually telling you that one of the p:xslt steps is receiving no input, not even an empty document-node.

I was able to reproduce the error by adding a p:sink and a p:identity before any of the p:xslt steps as shown below:

<p:declare-step name="main" xmlns:p="http://www.w3.org/ns/xproc"
  xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0">

    <p:input port="source" primary="true" sequence="true">
        <p:document href="temp/a.xml"/>
    </p:input>
    <p:input port="schema" sequence="true"/>
    <p:input port="stylesheet" sequence="true"/>
    <p:input port="parameters" sequence="true" kind="parameter"/>

    <p:output port="result" sequence="true">  
        <p:pipe step="pre-run" port="result"/>
        <p:pipe step="normalize-stl-xml" port="result"/>
        <p:pipe step="tf-transform" port="result"/>
        <p:pipe step="transformARDOnline" port="result"/>
        <p:pipe step="filterUnusedStyleLayout" port="result"/>
    </p:output>

    <p:xslt name="pre-run">
        <p:input port="stylesheet">  
            <p:document href="xslt/test.xsl"/> 
        </p:input>  
    </p:xslt>

    <p:sink/>
    <p:identity>
        <p:input port="source">
            <p:empty/>
        </p:input>
    </p:identity>

    <p:xslt name="normalize-stl-xml">
        <p:input port="stylesheet">  
            <p:document href="xslt/normalize_stl_xml.xsl"/> 
        </p:input>  
    </p:xslt>

    <p:xslt name="tf-transform">
        <p:input port="stylesheet">  
            <p:document href="xslt/tf_test_transform.xsl"/> 
        </p:input>  
    </p:xslt>

    <p:xslt name="transformARDOnline">
        <p:input port="stylesheet">  
            <p:document href="xslt/transformARDOnline.xslt"/> 
        </p:input>  
    </p:xslt>

    <p:xslt name="filterUnusedStyleLayout">
        <p:input port="stylesheet">  
            <p:document href="xslt/filterUnusedStyleLayout.xslt"/> 
        </p:input>  
    </p:xslt>

    <p:store href="ebu-tt_ard_online.xml" media-type="text/xml"/>

</p:declare-step>

I also added the input declarations as you mentioned in your comments. I did change the source input to primary. Primary inputs and outputs are bound automatically, so you can leave out all input source declarations as you can see from my code above. Same accounts for input of type parameter, which is bound automatically as well. By leaving them out, any command-line parameter is passed to p:xslt automatically.

Not an exact answer, but hopefully it helps you get closer to the problem. Your code runs fine at my end with both Calabash 0.9.40 and 1.0.9-94, as far as I could tell without the actual input and xslt's.

HTH!

grtjn
  • 20,254
  • 1
  • 24
  • 35
  • Thx for the reply. I did check if I was misspelling the file-name like you suggested but there was nothing wrong in the way I was using the command. I did however try to put both calabash executable file and my .xpl file in the same folder. This time however, I'm getting a different error (which also showed when I ran it from the oXygen editor GUI). $ java com.xmlcalabash.drivers.Main stlxml.xpl Mai 07, 2013 4:47:08 PM com.xmlcalabash.util.DefaultXProcMessageListener error SEVERE: Either a source document or an initial template must be specified – gops May 10 '13 at 09:38
  • @user2358380 You are not declaring any inputs are you? Which version of Calabash are you using? I may not be on the most recent one, so that could explain difference in behaviour as well.. – grtjn May 10 '13 at 17:24
  • calabash-1.0.9-94 is the version I'm using. Well, in the code above I've missed out pasting the input decelerations, but here's how I've actually declared the inputs. – gops May 13 '13 at 08:36
  • @gops Ah, you are declaring inputs. Then you must specify inputs on the command line. I didn't declare inputs at all, as you are explicitly loading input through `p:document`. Perhaps that is the largest difference. What happens if you comment out all your top-level inputs? – grtjn May 13 '13 at 13:04
  • Thx again for the reply. I did try to give the input source from the command line but still got the error. However this time, I tried commenting out all the top-level inputs (leaving the outputs unchanged) but I'm still getting the same error "Either a source document or an initial template must be specified". – gops May 13 '13 at 15:09
  • @gops Ah wait, that is a different error message. Or actually, you were talking about two different ones. I only responded on the latter one. The first is coming from the `p:xslt` step. It seems to be receiving no input, which seems odd, but not impossible. You are sure a.xml exists on indicated location and has contents? Or it could be a plain bug in Calabash. I wanted to check, but the site is down, so I have to check later.. – grtjn May 13 '13 at 18:58
  • Well, the latter error in my opinion was probably because of incorrect command arguments and its no longer seen now. The former error on the source document being unfetchable is one that's troubling. I'm quite sure the .xml file is available and readable with contents (I'm not sure if can share it here though). Only thing different about this .xml file is that it lacks `xmlns` namespace attributes, but I hope that isn't an issue. – gops May 14 '13 at 09:35
  • I've tried the exact code that you have added above with the changes you mentioned, but somehow I end up getting the same error on the source document as unspecified. Looks like I've hit a dead end. – gops May 16 '13 at 15:19
  • @gops yes, I added `p:sink` and `p:identity` on purpose to reproduce your error message. If you comment both out, the error disappeared at my end, using some random input and identity transform xsl's.. – grtjn May 16 '13 at 19:00
  • Well i meant that I did try the exact code without the `p:sink` and `p:identity` elements. I still end up getting the same error. – gops May 21 '13 at 09:56
  • Thre XSLT file used for the transformation contains `xsl:result-document href="{$outFile}"` command that is probably storing the result. Could this be the reason why the document is not received as intended at source.? – gops May 23 '13 at 12:58
  • @gops Yes, that is very likely the cause. Documents written within the xslt using `xsl:result-document` appear on the 'secondary' output port of `p:xslt`, not on the primary output port. If your initial template only contains this `xsl:result-document` statement, then the primary output port is likely to procuce nothing, which causes a problem for the next `p:xslt` step. – grtjn May 27 '13 at 05:26