Page 1 of 1

XProc error err:XC0050 access denied

Posted: Tue Feb 25, 2020 1:17 pm
by Martin Honnen
Using oXygen 22 and the built-in Calabash XProc processor to run an XProc example that tries to use p:store I get
err:XC0050 : XProc error err:XC0050 It is a dynamic error if the URI scheme is not supported or the step cannot store to the specified location. Zugriff verweigert
When I run Calabash from the command line with the same files I don't get that error.

The XProc code is

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" xpath-version="2.0"
    xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0">
    <p:input port="source">
        <p:empty/>
    </p:input>
    
    <p:output port="result" primary="true" sequence="true">
        <p:pipe port="result" step="secondary-storage"/>
    </p:output>
    
    <p:xslt name="xslt-pagelist" version="2.0">
        <p:input port="stylesheet">
            <p:document href="page-list.xsl"/>
        </p:input>
        <p:input port="source">
            <p:document href="toc.xml"/>
        </p:input>
        <p:input port="parameters">
            <p:empty/>
        </p:input>
    </p:xslt>
    
    <p:store href="toc-list.html"/>
    
    <p:for-each name="secondary-storage">
        <p:iteration-source select=".">
            <p:pipe port="secondary" step="xslt-pagelist"/>
        </p:iteration-source>
        <p:output port="result">
            <p:pipe port="result" step="store"/>
        </p:output>
        <p:store name="store">
            <p:with-option name="href" select="document-uri(.)"/>
        </p:store>
    </p:for-each>
    
</p:declare-step>
the XML input to the p:xslt step is

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<book>
    <chapter>
        <section>
            <title>section 1</title>
        </section>
        <section>
            <title>section 2</title>
        </section>
        <section>
            <title>section 3</title>
        </section>
    </chapter>
    <chapter>
        <section>
            <title>section 1</title>
        </section>
        <section>
            <title>section 2</title>
        </section>
        <section>
            <title>section 3</title>
        </section>
    </chapter>
    <chapter>
        <section>
            <title>section 1</title>
        </section>
        <section>
            <title>section 2</title>
        </section>
        <section>
            <title>section 3</title>
        </section>
    </chapter>
</book>

The p:store href="toc-list.html" seems to be executed fine even from inside oXygen but I guess the error is caused by the p:store steps inside of the p:for-each, only that it works fine when run from the command line. Any idea where Calabash inside oXygen tries to write the secondary result files of the p:xslt step I am trying to store with the p:store inside of the p:for-each?

Re: XProc error err:XC0050 access denied

Posted: Tue Feb 25, 2020 3:16 pm
by Mircea
Hi Martin,

It seems that oXygen does not have the writing permissions for the specified location.
The step attempts to store the XML document to the specified URI. It is a dynamic error (err:XC0050) if the URI scheme is not supported or the step cannot store to the specified location.
err:XC0050
It is a dynamic error if the URI scheme is not supported or the step cannot store to the specified location.
See: p:store
I tried the samples you provided and if the location where you need to save teh result is not available for writing I obtain the same result.

Regards,
Mircea.

Re: XProc error err:XC0050 access denied

Posted: Tue Feb 25, 2020 3:25 pm
by Martin Honnen
But why would Calabash in oXygen be able to write out the "toc-list.html" (that file is written/updated) while not being able to write out the "section-X.X.html" files that are supposed to be written to the same directory? I don't understand where the "document-uri(.)" leads to with Calabash in oXygen while with Calabash from the command line it writes out the "section-X.X.html" files to the same directory as the toc-list.html.

Re: XProc error err:XC0050 access denied

Posted: Tue Feb 25, 2020 3:39 pm
by Mircea
I do not have your stylesheet to check the problem.
I used a simple "copy-stylesheet" to check the behaviur, but that do not create additional files.

Re: XProc error err:XC0050 access denied

Posted: Tue Feb 25, 2020 3:43 pm
by Martin Honnen
Sorry, my bad, I thought I had inserted all files in the original post, somehow I forgot the XSLT:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    exclude-result-prefixes="xs"
    version="2.0">
    
    <xsl:output method="html" indent="yes" version="5"/>
    
    <xsl:template match="/">
        <html>
            <head>
                <title>TOC</title>
            </head>
            <body>
                <h1>TOC</h1>
                <ul>
                    <xsl:apply-templates select="//chapter/section"/>
                </ul>
            </body>
        </html>
    </xsl:template>
    
    <xsl:template match="chapter/section">
        <xsl:variable name="nr" as="xs:string">
            <xsl:number level="multiple" count="chapter | section" format="1.1"/>
        </xsl:variable>
        <li>
            <a href="section-{$nr}.html">
                <xsl:value-of select="title"/>
            </a>
        </li>
        <xsl:result-document href="section-{$nr}.html">
            <html>
                <head>
                    <title>
                        <xsl:value-of select="title"/>
                    </title>
                </head>
                <body>
                    <h1>
                        <xsl:value-of select="title"/>
                    </h1>
                </body>
            </html>
        </xsl:result-document>
    </xsl:template>
</xsl:stylesheet>

Re: XProc error err:XC0050 access denied

Posted: Tue Feb 25, 2020 5:12 pm
by Martin Honnen
Instead of using p:store inside of the p:for-each I have simply tried to output the document-uri(.) of each document processed there and outside of oXygen, with Calabash from the command line, the URIs point to the current working directory where I have the XML document and the XProc file and where the p:store outside the p:for-each writes to, while Calabash run inside of oXygen has URIs in the form of

Code: Select all

file:/C:/Program%20Files/Oxygen%20XML%20Editor%2022/section-1.2.html
So basically that explains why my earlier attempt gives the access denied error.

I am not sure however I have missed a setting or configuration or XProc attribute I would need to set, still I wonder why Calabash from the command line manages to store all files in the same directory while inside oXygen the sole p:store uses the directory where the XProc, XML and XSLT files reside but the p:store trying to write the secondary results from the p:xslt step have acquired a URI in the oXygen installation directory.

What do you think? Does the XProc code I have need a fix? Or Calabash inside oXygen?

Re: XProc error err:XC0050 access denied

Posted: Tue Feb 25, 2020 5:19 pm
by Mircea
It seems that the problem is in the following line:
<p:with-option name="href" select="document-uri(.)"/>
In my case the "section-X.X.html" files were generated in the oXygen installation directory.
It works from the command line because the URI of "." is the directory where you start the Calabash.
So I suggest you to provide the "href" for the p:store step in a different manner.
For a more specialized help please adress to the Calabash discussions lists.

Re: XProc error err:XC0050 access denied

Posted: Tue Feb 25, 2020 5:22 pm
by Mircea
It seems that we both replyed in the same time.
Yes, the XProc code needs a fix.