saxon

How to use the XSLT fn:document function in Saxon-HE to read an XML string?

女生的网名这么多〃 提交于 2019-12-12 03:06:36
问题 I'm using the .net version of Saxon-HE. I've written some code to set up an XSLT transformation where the source XSLT is passed in from outside (not read from a file at run-time). Here's a snippet of my code: Saxon.Api.Processor processor = new Saxon.Api.Processor(); // Feed the XSLT into Saxon XmlDocument document = new XmlDocument(); document.LoadXml(xslt); Saxon.Api.XdmNode input = processor.NewDocumentBuilder().Build(document); Saxon.Api.XsltCompiler xsltCompiler = processor

How to set the value of a variable in a udf requiring a path-call

喜欢而已 提交于 2019-12-12 02:04:17
问题 I'm trying to use a user-defined function in XSLT that repeatedly calls the value of a certain string. That string is based on the outcome of an XPath expression that doesn't change within the span of a single function call. I thought it would be a good idea to assign it to a variable rather than look it up over and over again. Unfortunately, at least in Saxon's implementation, you cannot use an XPath expression requiring a node inside a function, even one based on an absolute path, without

Recursive call to a duplicated Bash script, making it unable to access the assets

拜拜、爱过 提交于 2019-12-12 01:48:35
问题 Edit : This post is now addressed in a new, as the problem as to be presented slightly differently. It's here : How can I efficiently run XSLT transformations for a large number of files in parallel? I'm stuck in my attempts of parallelizing a process, and after some decent time spent on it I'd like to request some help ... Basically, I have a lots of XML files to transform with a specific XSLT sheet. But the sheet uses a call to an (very slow) API to fetch additional data, and taking the

XSLT: Transform XML files tree

落爺英雄遲暮 提交于 2019-12-12 01:35:55
问题 I have the following file structure (XML files 'index.xml' in nested folders): index.xml foo/index.xml foo/sub/index.xml foo/.../index.xml bar/.../index.xml Now I have to transform each of this XML files with a given XSL stylesheet. The result should be the same folder structure (overwriting would be OK). What would be your approach to achieve this? My system: OS X 10.6, Saxon XSLT processor 回答1: Using Bash How about putting the find command in a file and make the file executable: find .

Retrieving hashmap values in XSLT 2.0 Using Saxon-HE

谁说我不能喝 提交于 2019-12-12 01:04:15
问题 I want to pass Map object as parameter in XSLT 2.0 version and i want to retrieve the Map object data under XSLT 2.0 file using Saxon-HE. I googled a lot and found Retrieving hashmap values in XSLT link which completely matches according to my need but i am getting exception such as Static error in {map:get($mapData,'1')} in expression in xsl:variable/@select on line 23 column 94 of transformer.xslt: XPST0017: Cannot find a 2-argument function named {http://ns.saxonica.com/map}get(). I don't

Getting detailed error description from Saxon 9.x in .net

不想你离开。 提交于 2019-12-11 22:54:16
问题 I have an xslt2 transform engine setted up with saxon 9.x. I have some big xml file with large xsl transformation file. I can make the transform with XQSharp XSLT2 engine, but with saxon i am getting error: javax.xml.transform.TransformerConfigurationException: Failed to compile stylesheet. 1 error detected. I would like to get some more detailed error information from saxon with for example the linenumber of the error and the cause. The only two exceptions that i could found are: Saxon.Api

Transformation of multiple input files

怎甘沉沦 提交于 2019-12-11 19:45:00
问题 Right now i am using this java (which receives one xml file parameter) method to perform XSLT transformation: static public byte[] simpleTransform(byte[] sourcebytes, int ref_id) { try { StreamSource xmlSource = new StreamSource(new ByteArrayInputStream(sourcebytes)); StringWriter writer = new StringWriter(); transformations_list.get(ref_id).transformer.transform(xmlSource, new StreamResult(writer)); return writer.toString().getBytes("UTF-8"); } catch (Exception e) { e.printStackTrace();

Saxon doesn't support `saxon:output` anymore

吃可爱长大的小学妹 提交于 2019-12-11 19:44:07
问题 I'm trying to use Saxon 9.1.0.8 HE to apply (recent) Docbook XSL, and getting this: Don't know how to chunk with SAXON 9.1.0.8 from Saxonica Processing terminated by xsl:message at line 46 in chunker.xsl Docbook XSL source claims that: <!-- This stylesheet works with XSLT implementations that support --> <!-- exsl:document, saxon:output, or Xalan's redirect:write --> <!-- Note: Only Saxon 6.4.2 or later is supported. --> ...and a visit to line 46 mentioned in the error message (which tests

Cannot compare xs:string to xs:integer

空扰寡人 提交于 2019-12-11 18:46:54
问题 Currently running a code on Talend and it throws up this error net.sf.saxon.trans.XPathException: Cannot compare xs:string to xs:integer at net.sf.saxon.expr.GeneralComparison.typeCheck(GeneralComparison.java:255) when the saxon 9 is added to the configuration but when its removed it works fine. Any ideas why its interfering with the xpath 回答1: Which version of Saxon, precisely, did you add to the Configuration? Prior to Saxon 9.6, the Saxon jar file included a manifest indicating that it was

Hello World Saxon with Java

感情迁移 提交于 2019-12-11 18:07:24
问题 Using the JAR files installed through apt for Saxon-HE and tagsoup parsing html is a one-liner as: thufir@dur:~/saxon$ thufir@dur:~/saxon$ java -cp /usr/share/java/Saxon-HE-9.8.0.14.jar:/usr/share/java/tagsoup-1.2.1.jar net.sf.saxon.Query -x:org.ccil.cowan.tagsoup.Parser -qs:doc\(\'http://books.toscrape.com/\'\) <?xml version="1.0" encoding="UTF-8"?><!--[if lt IE 7]> <html lang="en-us" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--><!--[if IE 7]> <html lang="en-us" class="no-js lt-ie9 lt-ie8