- From: Martin Honnen <martin.honnen@gmx.de>
- Date: Sun, 22 Nov 2020 18:51:24 +0100
- To: xproc-dev@w3.org
- Message-ID: <ac34ca14-97b1-a304-7014-b19ce9f9c877@gmx.de>
On 22.11.2020 18:12, Martin Honnen wrote: > > > On 22.11.2020 17:34, David Birnbaum wrote: >> Dear XProc Dev, >> >> I've been struggling with filenames that are not compatible with >> URIs, and attempting to work around the limitation by using >> encode-for-uri() when I save the file. I described the general >> problem on the eXist-open mailing list, so I won't repeat it here, >> but my issue has an XProc aspect, and may even be an XProc—rather >> than broader filename—issue, and I would be grateful if someone on >> this list to help clarify that aspect of it for me. >> >> Here is a test XProc file, which I run under MorganaXProc-IIIse >> 0.9.4.8-beta: >> >> <?xml version="1.0" encoding="UTF-8"?> >> <p:declare-step xmlns:p="http://www.w3.org/ns/xproc >> <http://www.w3.org/ns/xproc>" >> xmlns:c="http://www.w3.org/ns/xproc-step >> <http://www.w3.org/ns/xproc-step>" >> version="3.0"> >> <p:input port="source"> >> <p:inline> >> <doc>Hello world!</doc> >> </p:inline> >> </p:input> >> <p:output port="result"/> >> <p:variable name="output-filename" >> select="encode-for-uri('test-1a%7%.xml')"/> >> <p:identity message="{$output-filename}"/> >> <p:store href="{$output-filename}"/> >> <p:identity/> >> </p:declare-step> >> >> >> Because the percent signs as they are used in the filename are >> incompatible with URI encoding, I expect them to be percent-encoded >> themselves, with the modified filename echoed to stderr (in the >> <p:identity> step) and used to save the test file (in the <p:store> >> step). What happens instead is that the percent encoded value is >> written, as expected, to stderr: >> >> test-1a%257%25.xml >> >> >> but the file is saved to the local filesystem as if encode-for-uri() >> had not been applied, that is, as: >> >> test-1a%7%.xml >> >> > > I don't have an explanation for that, perhaps ask Achim by raising an > issue on Morgana on Sourceforge. > Thinking about it again, I think you would see the same result using XSLT and xsl:result-document, the file: URI has the %25 but on creating a file name from it is decoded as %. That is probably simply what underlying URI to file path/name libraries in Java or .NET do.
Received on Sunday, 22 November 2020 17:51:43 UTC