Volker
Volker

Reputation: 33

Why is an external document resolved in Altova XMLSpy but not in SaxonHE10?

I want to load an external XML-document into a variable, which works in Altova XMLSpy but not in SaxonHE10.

In Altova XMLSpy the following XSLT 2.0 line returns true.

<xsl:copy-of select="fn:doc-available('https://www.xrepository.de/api/version_codeliste/urn:de:bund:destatis:bevoelkerungsstatistik:schluessel:staat_2019-02-01/genericode')"/>

In my local SaxonHE10 installation it returns false.

Are there any commandline parameters I can use to change this behavior?

Addition 18.10.2021 13:12: The comment section ist to small, so I edit my question: That is the XSLT:

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet
    version="2.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:html="http://www.w3.org/1999/xhtml"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:fn="http://www.w3.org/2005/xpath-functions"
    xmlns:xdf3="urn:xoev-de:fim:standard:xdatenfelder_3.0.0" 
    xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/" 
    exclude-result-prefixes="html"
>
    <xsl:template match="/">
        <xsl:message>
            <xsl:copy-of select="fn:doc-available('https://www.xrepository.de/api/version_codeliste/urn:de:bund:destatis:bevoelkerungsstatistik:schluessel:staat_2019-02-01/genericode')"/>
        </xsl:message> 
        <xsl:message>
            <xsl:copy-of select="fn:document('https://www.xrepository.de/api/version_codeliste/urn:de:bund:destatis:bevoelkerungsstatistik:schluessel:staat_2019-02-01/genericode')"/>                                  
        </xsl:message> 
    </xsl:template>
</xsl:stylesheet>

That is the command call:

"C:\Program Files\Saxonica\SaxonHE10.2N\bin\Transform.exe" -s:test.xml -xsl:test.xsl 

This is the result:

false
Error FODC0002 while evaluating xsl:message at line 20 of file:/C:/Users/Volker/Dropbox/FIM/Tools/QS%20Datenfelder/test.xsl: Document has been marked not available: https://www.xrepository.de/api/version_codeliste/urn:de:bund:destatis:bevoelkerungsstatistik:schluessel:staat_2019-02-01/genericode
<?xml version="1.0" encoding="UTF-8"?>

Upvotes: 0

Views: 406

Answers (1)

Martin Honnen
Martin Honnen

Reputation: 167401

Interestingly the doc and doc-available calls to the given URL work in the Saxon .NET based XSLT fiddle app I run.

As far as I can tell, the only IKVM setting I have there in the web.config (that might as well work in an app.config for non web use of .NET and Saxon) are the TLS settings e.g.

<configuration>
  
  <appSettings>

    <add key="ikvm:https.protocols" value="TLSv1,TLSv1.1,TLSv1.2" />
  </appSettings>
</configuration>

So that would be worth a try, that any .NET users of Saxon for which the URI fails add the above setting to the app.config or web.config.

I now tried some simple C# code using Saxon HE 10.6 .NET with e.g.

        Processor processor = new Processor();

        string xpathExpression = "doc-available('https://www.xrepository.de/api/version_codeliste/urn:de:bund:destatis:bevoelkerungsstatistik:schluessel:staat_2019-02-01/genericode')";

        Console.WriteLine(processor.NewXPathCompiler().EvaluateSingle(xpathExpression, null).GetStringValue());

        Console.ReadLine();

without any change to IKVM settings or app.config this outputs true. It turns out that the used .NET framework version is decisive or part of the reason, the first test was done with 4.8. Using 4.5 gives false, using 4.6 gives true.

Even without using Saxon or IKVM, a .NET framework 4.5 application doing

       string url = "https://www.xrepository.de/api/version_codeliste/urn:de:bund:destatis:bevoelkerungsstatistik:schluessel:staat_2019-02-01/genericode";

        var request = WebRequest.Create(url);
        {
            using (var response = (HttpWebResponse)request.GetResponse())
            {
                Console.WriteLine("Status: {0}", response.StatusCode);
                response.Close();
            }
        }

        Console.ReadLine();

fails to establish a connection as it gives some error about not being able to establish a protected SSL/TLS channel. Using .NET framework 4.8 no such problem arises. Still don't know how to get compiled and installed .exe files like Transform.exe or Query.exe from Saxon to switch/look for the latest/highest installed .NET framework instead of (I presume) the lowest they were compiled for and tested for to run with. https://learn.microsoft.com/en-us/dotnet/framework/network-programming/tls might give some clues.

Upvotes: 3

Related Questions