saxon

Making multiple files from multiple files with one command in gnu make

倾然丶 夕夏残阳落幕 提交于 2019-12-06 12:26:16
Assume 1000 files with extension .xhtml are in directory input, and that a certain subset of those files (with output paths in $(FILES), say) need to be transformed via xslt to files with the same name in directory output. A simple make rule would be: $(FILES): output/%.xhtml : input/%.xhtml saxon s:$< o:$@ foo.xslt This works, of course, doing the transform one file at a time. The problem is that I want to use saxon's batch processing to do all the files at one time, since, given the number of files, that would be much faster, considering the overhead of loading java and saxon for each file.

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

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 12:23:36
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.getNodeValue(); } return ""; } This works fine but i now i need the underlying html of a selected node

XML - XSLT - Escape special characters

两盒软妹~` 提交于 2019-12-06 11:45:11
this question is related to another question I posted and still am trying to figure out, here: XML - XSLT - Using two XML files - Additions to XML file consulting another XML file , but since this is a simplier problem, I decided to make a new post about it, to make this problem more "readable" and usefull for future readers of this post, I have the following XML file: <?xml version="1.0" encoding="UTF-8"?> <entry> <text-prop name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-prop> </entry> And I'm just performing the simple identity transform method with the XSLT: <xsl

XSLT - Parameter as a series of nodes

此生再无相见时 提交于 2019-12-06 08:32:46
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="PnewArticles" as="element()*"> <file-name>XMLFile.XML</file-name> <file-name>XMLFile2.XML</file-name> <

Difficulty getting Saxon into XQuery mode instead of XSLT

冷暖自知 提交于 2019-12-06 05:15:11
问题 I'm having difficulty getting XQuery to work. I downloaded Saxon-HE 9.2. It seems to only want to work with XSLT. When I type: java -jar saxon9he.jar I get back usage information for XSLT. When I use the command syntax for XQuery, it doesn't recognize the parameters (like -q), and gives XSLT usage information. Here are some command line interactions: >java -jar saxon9he.jar No source file name Saxon-HE 9.2.0.6J from Saxonica Usage: see http://www.saxonica.com/documentation/using-xsl

Saxon-HE Integrated Extension Functions | how and where?

試著忘記壹切 提交于 2019-12-06 04:43:12
问题 Although writing Saxon Integrated Extension Functions are pretty clear to me. I have red: http://www.saxonica.com/html/documentation/extensibility/integratedfunctions/ http://www.saxonica.com/html/documentation/extensibility/integratedfunctions/ext-simple-J.html I'm having extremely hard time finding information how to actually get them to work. Q: Where to put files, do I have to complie anything, do I have to edit saxon configuration? Basically what do I have to do to get this working

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

为君一笑 提交于 2019-12-06 01:56:58
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. 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 transformations. Since I also needed information on how to combine with saxon - here are the modifications for saxon,

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

萝らか妹 提交于 2019-12-06 01:35:57
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 returns name="value" when selecting an attribute. And I can call XdmItem.getStringValue() to get the string

XSLT: CSV (or Flat File, or Plain Text) to XML

好久不见. 提交于 2019-12-06 00:28:49
I am trying to convert plain text files to XML files using XSLT. I started with CSV files, because that is a well-known file format that I could start Googling examples on. I stumbled onto this: http://ajwelch.blogspot.com/2007/02/csv-to-xml-converter-in-xslt-20.html , which also points at http://andrewjwelch.com/code/xslt/csv/csv-to-xml_v2.html . Those links contain what is, supposedly, an XSLT (2.0) that can take a CSV file and convert it to an XML file. ...Except it doesn't actually work. I set it up in my Maven Eclipse project, downloaded the latest Saxon dependency (9.4 HE) and tried to

Moving files after failed validation (Java)

旧城冷巷雨未停 提交于 2019-12-05 20:53:59
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 tried putting System.gc() before moving the file and that sorted the problem but we can't have System