xalan

Get current nodes xpath

試著忘記壹切 提交于 2019-12-19 03:59:41
问题 I need to get the xpath of current node for which i have written an xsl function <func:function name="fn:getXpath"> <xsl:variable name="xpath"> <xsl:for-each select="ancestor-or-self::*"> <xsl:value-of select="concat($xpath, name())" /> <xsl:if test="not(position()=last())"> <xsl:value-of select="concat('/', $xpath)" /> </xsl:if> </xsl:for-each> </xsl:variable> <func:result select="$xpath" /> </func:function> But when I run this, I'm getting the following error file:///D:/test.xsl; Line #165;

How to use a parameter in a xslt as a XPath?

旧时模样 提交于 2019-12-18 19:07:32
问题 I'd like to add an element to a xml document and I'd like to pass as a parameter the path to the element. sample.xml file: <?xml version="1.0"?> <stuff> <element1> <foo>2</foo> <bar/> </element1> <element2> <subelement/> <bar/> </element2> <element1> <foo/> <bar/> </element1> </stuff> Using: xalan.exe -p myparam "element1" sample.xml addelement.xslt I'd like the following result: <?xml version="1.0"?> <stuff> <element1> <foo>2</foo> <bar/> <addedElement/> </element1> <element2> <subelement/>

NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces

时间秒杀一切 提交于 2019-12-18 14:46:05
问题 Trying to retrieve the SOAP body from a SOAP response, but getting this error: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces. Document doc = soapResMsg.getSOAPBody().extractContentAsDocument(); -- Exception is thrown here org.dom4j.io.DOMReader d4Reader = new org.dom4j.io.DOMReader(); org.dom4j.Document d4doc = d4Reader.read(doc); Using Saaj1.4 What would be a fix for this? 回答1: I faced the same problem. In my case, fix

How to prevent xalan.jar that has META-INF\services\javax.xml.transform.TransformerFactory from taking over JDK 1.6 built in Xalan implementation?

耗尽温柔 提交于 2019-12-17 19:53:35
问题 Consider this code (based entirely on flying saucer's "getting started" code, their rights reserved): package flyingsaucerpdf; import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; import org.xhtmlrenderer.pdf.ITextRenderer; public class PDFMaker { public static void main(String[] args) throws Exception { new PDFMaker().go(); } public void go() throws Exception { String inputFile = "sample.html"; String url = new File(inputFile).toURI().toURL().toString(); String

How to catch a nested exception in java

大城市里の小女人 提交于 2019-12-12 20:28:16
问题 I'm using Apache Xalan (v.2.7.1) to translate XML to XHTML in Apache Tomcat (v6.0.32). Sometimes the loading gets cancelled by the client and the following exception is thrown: javax.xml.transform.TransformerException: org.apache.xalan.xsltc.TransletException: ClientAbortException: java.io.IOException at org.apache.xalan.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:636) at org.apache.xalan.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:303) ... I would like to catch

How to tell Xalan to escape characters in HTML attributes

旧巷老猫 提交于 2019-12-12 19:22:51
问题 The result of the Java code below is <input value="<http://example.org/>"> What I want is <input value="<http://example.org/>"> The code is Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); Element input = doc.createElement("input"); input.setAttribute("value", "<http://example.org/>"); Transformer xform = TransformerFactory.newInstance().newTransformer(); xform.setOutputProperty(OutputKeys.INDENT, "yes"); xform.setOutputProperty("{http://xml.apache.org

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

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

org.springframework.ws and Xalan problem on Jboss EAP 6.x

可紊 提交于 2019-12-11 17:28:36
问题 Hello I'm facing problem with Jboss EAP 6.x after update org.springframework.ws - spring-xml In my project I have use Xalan in version 2.7.2 , now I want to update org.springframework.ws - spring-xml from version 2.4.0 to 2.4.4 and upload wars of my app on Jboss EAP 6.x While deployment I got error: Caused by: java.lang.IllegalArgumentException: Not supported: http://javax.xml.XMLConstants/property/accessExternalDTD at org.apache.xalan.processor.TransformerFactoryImpl.setAttribute

Java script XSLT Error : For extension function, could not find method java.lang.String. ([ExpressionContext,] #STRING)

大憨熊 提交于 2019-12-11 14:01:26
问题 HI, I am using Xalan to parse my xsl file. The xsl is working properly in the vb.net parsers. But Xalan gives error for that xsl. For extension function, could not find method java.lang.String.FctDateDuration([ExpressionContext,] STRING). Here is how I have define my xsl. xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:ttVB="ttVB" exclude-result Here is the java script calling part in xsl : - <xsl:variable name="start"> xsl