saxon

XSLT filter nodes based on given node list

橙三吉。 提交于 2019-12-08 07:08:50
问题 This may have already be answered somewhere, but I do not have right words to search it : Lets say I have data file which has list of cities : <cities> <city abbr='A'>NameA</city> <city abbr='b'>NameB</city> </cities> The cities list is long and I want to filter the cities based on abbr [filter data] <skip> <abbr>A</abbr> <abbr>B</abbr> </skip> How could I use the this filter data(in xml form) to skip some nodes from original data file , specifically how I can use in for-each loop e.g <xsl

can xquery be run practically from the CLI?

限于喜欢 提交于 2019-12-08 07:02:49
问题 How is this sample xquery executed from the CLI? xquery version "1.0"; let $message := 'Hello World!' return <results> <message>{$message}</message> </results> Inspired from zx485's answer: Check the separate libxslt page XSL Transformations, is a language for transforming XML documents into other XML documents (or HTML/textual output). A separate library called libxslt is available implementing XSLT-1.0 for libxml2. This module "libxslt" too can be found in the Gnome SVN base. You can check

How to parse HTML using XPath with Saxon-HE in command line?

二次信任 提交于 2019-12-08 06:37:23
问题 I use saxon HE 9.6, and it's great for playing with XPath 3 while you are parsing well formed XML files. But I would like to know how to combine expath-http-client (or any other working solution) with Saxon to have the power to parse realLife©®™ (possibly broken) HTML. (Java is not my better skill). I searched google quite many hours without any working solution. I tried something like : xquery_file.xsl : xquery version "1.0"; declare namespace http="http://expath.org/ns/http-client"; let

Saxon XMLBeans Tomcat

只愿长相守 提交于 2019-12-08 04:13:19
问题 We recently updated our Tomcat web service. The only things we really updated were that we updated XMLBeans to version 2.4 and Saxon to version 9. Running it Netbeans and eclipse, our project now works fine, but when trying to deploy to tomcat we get the following. We tried updating JAXEN to version 1.1.1 but no joy. Any ideas? The error we get in deployment is: java.lang.IllegalArgumentException: dom4j-core,jdom,xml-apis,xerces,junit-Extension-Name at java.util.jar.Attributes$Name.

XSLT Streaming Chained Transform

不打扰是莪最后的温柔 提交于 2019-12-08 03:15:23
问题 I am using Saxon EE to transform a very large document, using streaming transform. I now need to chain multiple XSLTs. How does one go about doing that ? When not streaming, I have used the XSLTTransformer class as destination, to do chained transforms. If I am not mistaken, I guess I cannot do that, as that would create a result tree as against result stream. Thanks, Ani 回答1: Pipe the SAX output events of the 1st transform into the SAX input events of the 2nd transform. I've attached some

How to get html from a org.w3c.dom.Node in java?

风格不统一 提交于 2019-12-07 20:11:28
问题 I've build a method which extracts data from an html document using the xpath components of saxon-he. I'm using w3c dom object model for this. I already created a method which returns the text-value, similar like the text value method from jsoup (jsoupElement.text()): protected String getNodeValue(Node node) { NodeList childNodes = node.getChildNodes(); for (int x = 0; x < childNodes.getLength(); x++) { Node data = childNodes.item(x); if (data.getNodeType() == Node.TEXT_NODE) return data

XSLT - Parameter as a series of nodes

旧时模样 提交于 2019-12-07 19:49:25
问题 My goal is to pass in the names of multiple files into an XSLT and process the files using document($myFile) . I'm trying to pass the parameter through on the command line using the saxon engine and it keeps throwing errors. I know I could write out a manifest file, process that in, and then delete it when I'm finished. But that just seems to be a lot of extra work that would potentially slow things down even more. The XSLT works when the parameter hard coded like this... <xsl:param name=

How to distinguish between attribute and element nodes returned from a Saxon XPathSelector

こ雲淡風輕ζ 提交于 2019-12-07 14:04:58
问题 Given the XML: <root name="value"> <level1> <level2>Text</level2> </level1> </root> I want the XPath /root/@name to return value , and the XPath /root/level1 to return the XML serialisation of the <level1> node: <level1> <level2>Text</level2> </level1> I'm using the a9api interface from Saxon 9.6 in Java. I've found that I can call XdmValue.toString() to get the XML serialisation of the result of the evaluation of the XPath, which gets me the desired result for selecting an element, but

Moving files after failed validation (Java)

早过忘川 提交于 2019-12-07 12:50:09
问题 We are validating XML files and depending on the result of the validation we have to move the file into a different folder. When the XML is valid the validator returns a value and we can move the file without a problem. Same thing happens when the XML is not valid according to the schema. If however the XML is not well formed the validator throws an exception and when we try to move the file, it fails. We believe there is still a handle in the memory somewhere that keeps hold of the file. We

How to perform schematron validation using Saxon java library command line tool?

此生再无相见时 提交于 2019-12-07 12:24:42
问题 Very basic question- I've a xml file and I want to validate it against a schematron file. How do I do it using Saxon command line? As per commandline reference I don't see any option to specify schematron file. 回答1: Expanding on the previous answer because I needed to do this and it didn't give enough info (and since my script is already doing a dozen XSL transforms - what's four more?) Based on this website an XML file can be validated against a schematron through a series of XSL