saxon

Convert JSON to XML using XSLT 3.0 functions

笑着哭i 提交于 2019-11-28 11:02:21
问题 I am new to XSLT, I have a simple JSON which I want to transform to an XML using XSLT 3.0. I tried parsejson and jsontoxml functions as per w3c recommendations, but produced output is not in desired format. I am using Saxonica processor for the purpose. Is it possible to write a single xslt which can be used in any given json of a particular structure irrespective of key names. Otherwise how can I approach to convert a json to desired xml using xslt features I tried the example in the answer:

How to call Java API from Ruby 1.8 or 1.9

╄→尐↘猪︶ㄣ 提交于 2019-11-28 09:06:37
问题 I've this JRuby working code (stolen from Keith's Blog), which wraps the SAXON xslt processor API. Now, I wonder whether I can and how can I wrap the same API in Ruby framework? Please tell me if this question is non-sense or if it can be improved in some way. This is the java doc reference for the wanted API. And this is the JRuby code I'm using: require 'java' module JXslt include_class "javax.xml.transform.TransformerFactory" include_class "javax.xml.transform.Transformer" include_class

Load xml and xslt from embedded resource in Saxon 9.4he

房东的猫 提交于 2019-11-28 04:11:34
问题 I am using Saxon 9.4 home edition (Saxon-HE 9.4 .NET) to get support for XSLT 2.0 and XPath 2.0, and XQuery 1.0 in .NET. My code crashes when I load files without an URI. Is it possible to load xml/xsl documents without an URI related to the document loaded? If not, is there any way to define URI for elements embedded in dll-files? Any other solutions will also be appreciated, my only term is that the files must be loaded from within the dll-file. My code works perfectly as long as i load xml

result tree fragment to node-set: generic approach for all xsl engines

允我心安 提交于 2019-11-28 01:16:46
问题 Answering another thread (see stackoverflow: generate css color schemes) I bumped into the issue below, where different xsl engines seem to need different approaches in transforming result tree fragments into node-sets. Simplifying the issue (but see link above for the full story behind this), I wish to have an inline tree containing a list of color values. As this has to be used in Xpath expressions, I had to create a node-set from it specifically for MSXML x.x xsl engine (XML Spy built-in

Use saxon with python

孤街浪徒 提交于 2019-11-27 22:35:45
I need to process XSLT using python, currently I'm using lxml which only support XSLT 1, now I need to process XSLT 2 is there any way to use saxon XSLT processor with python? There are two possible approaches: set up an HTTP service that accepts tranformation requests and implements them by invoking Saxon from Java; you can then send the transformation requests from Python over HTTP use the Saxon/C product , currently available on prerelease : details here: http://www.saxonica.com/saxon-c/index.xml A Python interface for Saxon/C is in development and worth a look: https://github.com/ajelenak

Using Xalan alongside Saxon

十年热恋 提交于 2019-11-27 18:23:41
问题 I use Xalan in my application, but need to use Saxon with a reference implementation to generate test output to compare with. I want to use them both during unit tests. However, as soon as I add an dependency on Saxon in the project .pom, the application seems to use Saxon for all xslt and XPath operations during tests: <dependency> <groupId>net.sf.saxon</groupId> <artifactId>Saxon-HE</artifactId> <version>9.4</version> <scope>test</scope> </dependency> This makes the main application fail

Using SAXON Xpath engine in Java

前提是你 提交于 2019-11-27 16:49:09
问题 Here is my code : public static void main(String[] args) { // System.setProperty( // "javax.xml.xpath.XPathFactory", // "net.sf.saxon.xpath.XPathFactoryImpl"); String xml="<root><a>#BBB#</a><a>#CCC#</a><b><a>#DDD#</a></b></root>"; try{ JDocument dom = new JDocument(xml); XPathFactory factory = net.sf.saxon.xpath.XPathFactoryImpl.newInstance(); XPath xpath = factory.newXPath(); XPathExpression expr = xpath.compile("//a[matches(.,'#...#')]"); Object result = expr.evaluate(dom, XPathConstants

How to execute XSLT 2.0 with ant?

笑着哭i 提交于 2019-11-27 08:08:55
I'm trying to run an XSLT transformation from an ant file. I'm using a XSLT 2.0 stylesheet with a saxon 9 parser (supporting XSLT 2.0). The problem is that it seems that ant is always calling an XSLT 1.0 parser. Here's my ant file : <xslt style="stylesheet.xslt" basedir="core/" extension=".xml" destdir="core/" classpath="D:\\DevTools\\saxon\\bin\\saxon9.jar"> </xslt> If I call it directly (without ant), it's working. Any idea ? The problem is that while Saxon is added to the classpath, the default JAXP mechanism to determine which TransformerFactory is used and it will use the default that is

Use saxon with python

╄→尐↘猪︶ㄣ 提交于 2019-11-27 04:32:32
问题 I need to process XSLT using python, currently I'm using lxml which only support XSLT 1, now I need to process XSLT 2 is there any way to use saxon XSLT processor with python? 回答1: There are two possible approaches: set up an HTTP service that accepts tranformation requests and implements them by invoking Saxon from Java; you can then send the transformation requests from Python over HTTP use the Saxon/C product , currently available on prerelease : details here: http://www.saxonica.com/saxon

XSLT: moving a grouping html elements into section levels

这一生的挚爱 提交于 2019-11-26 21:06:11
I'm trying to write an XSLT that organizes an HTML file into different section levels depending on the header level. Here is my input: <html> <head> <title></title> </head> <body> <h1>HEADER 1 CONTENT</h1> <p>Level 1 para</p> <p>Level 1 para</p> <p>Level 1 para</p> <p>Level 1 para</p> <h2>Header 2 CONTENT</h2> <p>Level 2 para</p> <p>Level 2 para</p> <p>Level 2 para</p> <p>Level 2 para</p> </body> </html> I'm working with a fairly simple structure at the moment so this pattern will be constant for the time-being. I need an output like this... <document> <section level="1"> <header1>Header 1