xpath-3.1

How do I call fn:sort() in Saxon from Java with multiple sort keys

浪子不回头ぞ 提交于 2020-08-10 19:17:33
问题 How do I use the sort function in Saxon when calling it from Java (not from XSLT). For example, for the query (data modeled on the Northwind database) I can get unsorted data using: /windward-studios/Employees/Employee But I want to get it sorted like the following (using SQL syntax here): /windward-studios/Employees/Employee order by City descending, LastName ascending How do I write the query to accomplish this? The full code for this is in SaxonQuestions.zip (minus license key) - TestSort

Is this the best way to get all elements & attributes in an XML file using Saxon?

送分小仙女□ 提交于 2020-08-10 19:17:20
问题 Our program displays a tree control showing the metadata structure of the XML file they are using as a datasource. So it displays all elements & attributes in use in the XML file, like this: Employees Employee FirstName LastName Orders Order OrderId For the case where the user does not pass us a XSD file, we need to walk the XML file and build up the metadata structure. The full code for this is at SaxonQuestions.zip, TestBuildTree.java and is also listed below. I am concerned that my code is

How do I load a JSON file into the DOM in Saxon running in Java?

空扰寡人 提交于 2020-08-10 19:17:19
问题 In my Java code I am trying to create a Saxon document (DOM) that is the contents of a JSON file. This should be possible but the code I have fails. The full code for this is at SaxonQuestions.zip, TestLoadJson.java and is also listed below. In this code the evaluate() fails. TestLoadJson.java import net.sf.saxon.Configuration; import net.sf.saxon.s9api.*; import org.xml.sax.InputSource; import org.xml.sax.XMLReader; import javax.xml.transform.sax.SAXSource; import java.io.*; import java.nio

JSON serialization with XPath 3.1 fn:serialize

◇◆丶佛笑我妖孽 提交于 2019-12-12 11:35:41
问题 I am using XSLT 3.0 in Saxon-HE 9.8 and would like to work with JSON documents as linked data in JSON-LD. In JSON-LD, full HTTP URIs often appear as values. When I use the XPath 3.1 fn:serialize to round-trip the data back to JSON, the solidus characters in http:// are escaped. Is it possible to avoid this escaping when serializing back to JSON? The fn:parse-json function has an escape parameter that can be set to true() or false() , but I don't see anything similar for fn:serialize . I can