saxon

Parse an XML fragment stored in a string into nodes in XSLT with SAXON for Java

北城余情 提交于 2019-12-12 20:29:19
问题 In my XSLT, I have a variable which contains a string. This string contains a fragment of XML. This is coming in programmatically, but its the equivalent of this: <xsl:variable name="xmlfrag" select="'<foo>this <bar>is</bar> it</foo>'"/> Is there a way to parse this XML and add it to the output? We're using SAXON for Java. 回答1: Use the saxon:parse() extension function . 回答2: The Dimitre solution requires a licensed version of Saxon. Here is another solution that works also with the free

Saxon9HE error XLM0001: Too many nested apply-templates calls. The stylesheet may be looping

試著忘記壹切 提交于 2019-12-12 16:59:43
问题 I'm using Saxon9HE to transform some XML 2.0. from a Java class; the solution is from this earlier question I'm transforming double pipe delimited text into XML. However, some of the fields contain people's resumes and the transform throws the looping error mentioned in the title. Is there a way fix this? I read about increasing the maximum depth in templates stack but that only applies to Oxygen; is there a similar setting in the Saxon9HE.jar? Here's the code, you can also click on the link

Cannot access updated Java object from Saxon XSLT processor

筅森魡賤 提交于 2019-12-12 10:19:46
问题 I am working with an open source version of the Saxon XSLT processor "Saxon 9.0.0.2J from Saxonica" and am trying to make use of the java extensibility for the first time. I am running into an issue I suspect may be a limitation on the open source version, but wanted to check first whether there might be something I am just missing here. From the snippet below, my result is that the final value of $c1 does not change as a result of the call to greg:setTime() - i.e. the $c1 variable within

Can XSLT execute a shell script at the OS level?

十年热恋 提交于 2019-12-12 07:22:17
问题 I have a production flow that combines XSLT and some shell scripts in about 4 steps before it reaches completion. I execute each step manually at the moment. I'm using Saxon 9 from the command line in Linux. Can I have the xsl's execute shell scripts.. instead of me? (I know I could achieve the desired result in another way with Ant or Make.. but prefer to stay in XSLT if it is not a huge effort to do so) Update : I've minimized my shell scripts and sped things up using Xproc. I'm not

Unable to force eclipse to use Saxon XSLT processor

隐身守侯 提交于 2019-12-12 06:45:40
问题 I am newbie to OSGi and working on some java application with eclipse and need to use XSLT processor. I need to use Saxon processor. I have included it's dependency in OSGi bundle classpath and MANIFEST.MF like below: but I am getting following error: c.p.s.x.SchematronProviderXSLTFromSCH - Schematron preprocessor error java.lang.ExceptionInInitializerError: null at com.phloc.schematron.xslt.SchematronProviderXSLTFromSCH.<init>(SchematronProviderXSLTFromSCH.java:121) ~[phloc-schematron-2.7.1

Spring - XSLT, switching from Xalan to Saxon

牧云@^-^@ 提交于 2019-12-12 05:26:57
问题 I had simple class: import org.apache.xalan.processor.TransformerFactoryImpl; public class HomePageXsltController extends AbstractXsltView { protected Source createXsltSource(Map model, String rootName, HttpServletRequest request, HttpServletResponse response) throws Exception { this.setTransformerFactoryClass(TransformerFactoryImpl.class); ... return new DOMSource(root); } } and I'm trying to use Saxon by setting transformerFactoryClass import net.sf.saxon.TransformerFactoryImpl; public

Saxon.Api.DynamicError, “Cannot find a matching 1-argument function named {exslt.org/common}node-set()”

删除回忆录丶 提交于 2019-12-12 04:53:40
问题 Hi Experts/Michael Kay I got "Saxon.Api.DynamicError - Cannot find a matching 1-argument function named {exslt.org/common}node-set(). There is no Saxon extension function with the local name node-set" by using saxon9he - v9.4.0.2. My XSLT file is calling "EXSLT". please help me to resolve the issue. public static StringWriter XSLT2(string sourceFile, string XSLT) { Processor processor = new Processor(); var setting = new XmlReaderSettings { DtdProcessing = DtdProcessing.Parse }; XmlReader

unwanted xml versions coming in Json output using xslt

邮差的信 提交于 2019-12-12 04:32:37
问题 I'm using XSL Stylesheet version=3.0 and Saxon-PE 9.6.0.7, I'm getting the xml version="1.0" encoding="UTF-8" tags is coming along in JSON Output: My Input xml file is: <?xml version="1.0" encoding="UTF-8"?> <description> <p>Here are some things other smokers say that they like about smoking:</p> <ul> <li>Smoking is a reward I can give myself when I finish a task.</li> </ul> </description> XSL which i used as: <xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

Using Saxon-PE with Apache Camel, Error Pre-Loading Saxon Classes

和自甴很熟 提交于 2019-12-12 04:19:02
问题 I have recently obtained a trial license for Saxon-PE and wish to use this version of Saxon within Camel. I downloaded the Saxon-PE-9.6.0.8 jars and have included them into my project via maven. I am using Camel 2.16.0. I have tried many approaches to this, but I have made the most headway by using Camel's "?transformerFactory=..." option and passing it Saxon's ProfessionalTransformerFactoryImpl, which is registered as a bean in my Spring config. When starting my application, the route

Calling Java API from XSL throws exception “The URI http://xml.apache.org/xslt/java does not identify an external Java class”

南笙酒味 提交于 2019-12-12 03:49:18
问题 I'm using SAXON processor for xsl file as follows: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:java="http://xml.apache.org/xslt/java" exclude-result-prefixes="java"> <xsl:output method="xml"/> <xsl:template name="printjavaDate"> <xsl:variable name="date" select="java:java.util.Date.new()"/> <xsl:value-of select=""/> </xsl:template> But this code isn't working for me. It throws error: javax.xml.transform