I am in the process of converting some XSLT (more specifically schematron validation rules) from using Altova to Saxon.NET (Saxon-HE version="9.7.0.4") as the XSLT processor. However, I came to a problem which I cannot find a resolution for.
The problem is with the document() function. In my XSLT I have:
<sch:let name="params" value="document('https://some_web_address')"/>
This URL brings back an XML of parameters which the XSLT uses. The problem is that this works in Altova but does not work (returns empty) when I started using Saxon.NET
After trying doc-available()/unparsed-text-available() functions, it seems like none return true for the XML coming from the URL. However, if I create a xml file of the returned xml data, place it in the local directory (local to my XSLT) and specify the full path to the xslt, unparsed-text-available() function returns true, yet doc-available() still returns false. I even created a small dummy XML sample:
<?xml version="1.0" encoding="UTF-8"?>
<parameters>
<parameter>100</parameter>
</parameters>
The XML is valid, but came back with same exact results (doc-available() = false, unparsed-text-available() = true)
I have looked at some of the other related questions on here (XSLT Document() Function results in Saxon Error/ Attribute-String cant be used as Filepath) but none of them fully resolved my problem.
This issue might have to do something with the base URI of the XSLT sheet, so I run: base-uri(.) and static-base-uri() and both returned empty.
So my questions are:
- Is is possible to use a URL (web URI) as a parameter to document() with Saxon.NET?
- If not, what am I doing wrong where doc-available() is false but unparsed-text-available() returns true for a valid xml file (as shown above)?
The ideal solution for me would be to use the URL, but it can be downgraded to using a local file. I would appreciate if anyone can help me with this.
doc-available($doc1-uri)anddoc($doc1-uri)/parameters/parameterand run it with Saxon .NET 9.7 EE and HE and the the result istrue<parameter>100</parameter>so that works fine. I simply runtransform.exefor that test. It is not clear whether you use the command line tool or some .NET code but you might want to explain and show in more detail how you use Saxon .NET.