saxon

Running XQuery on the command line

一笑奈何 提交于 2019-12-11 01:48:13
问题 It sounds like I need some type of XML processor It looks like theres a program called Saxon which I can use to run XQuery When I try this websites example I get Error: Could not find or load main class net.sf.saxon.Query I don't know how to set up the java package from the saxon package I downloaded. Id like to know if there is an easier option to be able to run XQuery from the command line other than this java package? All I want to do is process an xml file with commands like "Select where

Implementing HTML DOM rewriting logic on the server

…衆ロ難τιáo~ 提交于 2019-12-10 19:38:54
问题 My application does massive rewriting of the DOM on the client side at load time. It traverses the page scanning for special markup (think Markdown) or other patterns, replacing them with sometimes rather complicated DOM structures (using DOM calls such as createElement ) to style text but also create diagrams and graphics. I adopted this architecture in order to avoid any build or preprocessing steps. It works fine in a desktop browser, but is noticeably slow on mobile devices (several

How to check if xml textnode has Chinese characters with RegEx in a XSLT

倾然丶 夕夏残阳落幕 提交于 2019-12-10 16:09:00
问题 On this website http://gskinner.com/RegExr/ (which is a RegEx test website) this regex match works Match: [^\x00-\xff] Sample Text: test123 或元件数据不可用 But if I have this input XML: <?xml version="1.0" encoding="UTF-8" ?> <root> <node>test123 或元件数据不可用</node> </root> and I try this XSLT 2.0 stylesheet with Saxon 9: <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/root/node"> <xsl:if test="matches(., '[^

XSLT 3.0 streaming (Saxon)

二次信任 提交于 2019-12-10 13:47:47
问题 I have a big XML file (6 GB) with this kind of tree: <Report> <Document> <documentType>E</documentType> <person> <firstname>John</firstname> <lastname>Smith</lastname> </person> </Document> <Document> [...] </Document> <Document> [...] </Document> [...] </Report> If I apply an XSLT style sheet on it, I have this error: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space So I wanted to try the new XSLT 3.0 feature: streaming, with Saxon 9.6 EE. I don't want to have the

Using Saxon from VB6

安稳与你 提交于 2019-12-10 12:19:25
问题 I need to invoke XSLT 2.0 transformations from a legacy VB6 application. I had a very good previous experience with the command line version of Saxon, so I decided to give the Saxon's .NET version a try. This is my first serious experience with COM/.NET interoperation mechanism and, unfortunately, all my quick attempts to make Saxon .NET available to my VB6 application have failed: depending on the versions of Saxon and .NET that I tried, the Saxon API classes either don't seem to work or don

Saxon Prematurely Evalutes xsl:attribute-set

送分小仙女□ 提交于 2019-12-10 10:52:38
问题 This relates to schema-aware validation of inputs into an XSLT transformation using latest Saxon EE 9.8. My XSLT file contains the following. A namespace and associated schema defined as such: <xsl:import-schema namespace="http://www.fpml.org/2005/FpML-4-2" schema-location="/path/to/some_swbml.xsd"/> A result document conforming to the above schema: <xsl:result-document method="xml" href="{$file}" format="swbml-format" validation="strict"> <SWBML xmlns="http://www.fpml.org/2005/FpML-4-2" xsl

Call Java instance methods in XSLT

余生长醉 提交于 2019-12-09 16:43:27
问题 I am using Saxon (I could use Xalan if necessary) XSLT processor to do some transformation. I want to pass the instance of below object to the XSLT template as parameter. public class Test { private String value; public Test(String v) { value = v; } //getters, setters etc. } So I create this object, ie. Test test = new Test("test"); transformer.setParameter("test", test); In XSLT file I declare the param as: <xsl:param name="test" required="yes" as="jt:com.whatever.package.Test" xmlns:jt=

SAX error: incompatible types: String cannot be converted to InputSource

為{幸葍}努か 提交于 2019-12-08 09:35:17
问题 Relevant code; barfs on instantiating the SAXSource : TransformerFactory factory = TransformerFactory.newInstance(); XMLReader xmlReader = XMLReaderFactory.createXMLReader("org.ccil.cowan.tagsoup.Parser"); Source input = new SAXSource(xmlReader, "http://books.toscrape.com/"); Result output = new StreamResult(System.out); factory.newTransformer().transform(input, output); The JavaDoc's say: public SAXSource(XMLReader reader, InputSource inputSource) Create a SAXSource, using an XMLReader and a

Writing Out a DOM as an XML File

自古美人都是妖i 提交于 2019-12-08 09:14:20
问题 Straight from the manual: Writing Out a DOM as an XML File After you have constructed a DOM (either by parsing an XML file or building it programmatically) you frequently want to save it as XML. This section shows you how to do that using the Xalan transform package. Using that package, you will create a transformer object to wire a DOMSource to a StreamResult. You will then invoke the transformer's transform() method to write out the DOM as XML data. my output: thufir@dur:~/NetBeansProjects

Calling jQuery-UI components in XSL using Saxon-JS and its global Javascript function namespace?

為{幸葍}努か 提交于 2019-12-08 07:51:13
问题 Related to this question, you can call Javascript functions from XSL 2.0 transforms running in the browser using Saxon-JS. But I can't seem to invoke the jQuery-UI calls. My only thought is that it may be a timing issue where the jQuery selector can not find the target object's ID because Saxon-JS has yet to render it to the DOM. My simple test follows... The XML... <?xml version="1.0" encoding="UTF-8"?> <data> <date month="7" day="17" year="2017"/> </data> The XSL... <?xml version="1.0"