cfoster / saxon-jing

Extension Functions allowing Saxon to validate documents against RelaxNG Schemas
http://www.cfoster.net/saxon-jing/
Other
11 stars 3 forks source link

UNC path fails #5

Open Arithmeticus opened 5 years ago

Arithmeticus commented 5 years ago

When working with Saxon-jing at a server's base uri that returns native UNC pathnames to the XSLT engine, I get error rng:RNGE0003 with rng:schema-report(). That is, if I am working off a server and I have the following snippet in report.xsl...

<xsl:variable name="this-uri" select="resolve-uri('../schemas/test.rnc', static-base-uri())"/>
<xsl:message select="$this-uri"/>
<xsl:variable name="report" as="function(node()) as element(report)" select="rng:schema-report($this-uri)"/>

...I get:

file:////PATHNAME/schemas/test.rnc
Error at char 18 in xsl:variable/@select on line 73 column 64 of report.xsl:
rng:RNGE0003: Unable to find Schema file 
'file:////PATHNAME/schemas/test.rnc'

But it works fine if I have those same files on my local drive, or if I bind $this-uri to an absolute URI based upon a mapped drive name, e.g., G:/schemas/test.rnc.

Such UNC paths work fine elsewhere throughout my XSLT code.

cfoster commented 5 years ago

There is an outstanding bug #3 where relative paths should be resolved against the static-base-uri instead of the working directory - if I remember correctly. I still need to do this, just over-loaded at the moment unfortunately.

UNC Paths appear to work, I've written a test case to show this working.

I think the the UNC Path you are producing may not actually be resolvable in the first place, prior to it being given to Saxon-Jing.

Without Saxon-Jing and Saxon alone, please try out:

<xsl:variable name="this-uri" select="resolve-uri('../schemas/test.rnc', static-base-uri())"/>
<xsl:message select="$this-uri"/>

<xsl:message>
  <xsl:value-of select="unparsed-text($this-uri)"/>
</xsl:message>

And you'll see Saxon probably failing to find it too.

Arithmeticus commented 5 years ago

For your test, the Saxon returned the whole .rnc file for me, just fine. So there must be something else. There is an absolute form of the UNC path that Saxon doesn't like, but that's not a factor here, since Saxon is returning its favored syntax. I'll do some more tests next week and see what gives.

I tried to send a note of thanks on http://www.cfoster.net/contact but I got a Java error when I did, so I'll just mention here that the RNC validator has been massively helpful to me, and am grateful for you making it available.

jk

On Thu, Sep 12, 2019 at 6:38 AM Charles Foster notifications@github.com wrote:

There is an outstanding bug #3 https://github.com/cfoster/saxon-jing/issues/3 where relative paths should be resolved against the static-base-uri instead of the working directory - if I remember correctly. I still need to do this, just over-loaded at the moment unfortunately.

UNC Paths appear to work, I've written a test case https://github.com/cfoster/saxon-jing/commit/7fab81b307071e0baeac7a5b16ea72b6949e0559 to show this working.

I think the the UNC Path you are producing may not actually be resolvable in the first place, prior to it being given to Saxon-Jing.

Without Saxon-Jing and Saxon alone, please try out:

And you'll see Saxon probably failing to find it too. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub , or mute the thread .

-- Joel Kalvesmaki kalvesmaki.com

cfoster commented 5 years ago

Thanks for your comments - I'm glad it's been helpful to you.

If there are too many slashes at the start of the URI or something odd where Saxon can cope with it but some internal Java URI resolver somewhere within (Saxon-Jing / Jing) can't cope - I can probably write a quick patch to get the URI cleaned up and simplified before passing it on.