xalan

Get first child node in XSLT using local-name()

天涯浪子 提交于 2019-12-05 06:04:02
Assume we have this simple xml ... <books> <book> <author/> <title/> </book> <book> <author/> <title/> </book> </books> I'm using this xpath to get the elements of the first book instance. //books[1]/* Returns <author/> <title/> And that works fine, but I have to get it working using local-name(). I've tried the following but none of these work... //*[local-name()='books']/* this returns repeating author and title elements, not good, I only need them from the first child //*[local-name()='books'][0]/* this does not return anything Basically, I want to create a CSV file, so the first line in

Saxon 9 XSLT transformer vs Xalan 2.7

◇◆丶佛笑我妖孽 提交于 2019-12-05 05:25:27
I am currently using Xalan 2.7.0 for XSLT transformations over XML, but thinking over to switch to Saxon 9 version for XSLT transformations. So could someone list me the major cons and prons of using Saxon over Xalan . Although i know that Saxon supports XSLT 2.0 and other major changes but instead i would like to know more about personal experiences with Saxon 9 and its prons and cons and other benefits. I used Xalan 10 years ago. I have been using Saxon almost exclusively for the last 10 years. Not only is Saxon an XSLT 2.0 and XSLT 3.0 processor, but it is very actively developed and

Why is Apache Xerces/Xalan adding additional carriage returns to my serialized output?

[亡魂溺海] 提交于 2019-12-05 04:34:11
I'm using Apache Xerces 2.11.0 and Apache Xalan 2.7.1 and I'm having problems with additional carriage return characters in the serialized XML. I have this (pseudo) code: String myString = ...; Document doc = ...; Element item = doc.createElement("item"); item.appendChild(doc.createCDATASection(myString)); Transformer transformer = ...; ByteArrayOutputStream stream = new ByteArrayOutputStream(); Result result = new StreamResult(stream); transformer.transform(new DOMSource(document), result); Now myString contains line breaks ( \r\n ), (actually it's base64 encoded data) but when I look at the

XALAN register Extension Function like in SAXON

[亡魂溺海] 提交于 2019-12-04 19:47:39
i want to transform a XML by XSLT with XALAN. Now i want to use a extension-function, this function have to be added in JAVA source like in SAXON: Method: TransformerFactory tFactory = TransformerFactory.newInstance(); Configuration c = ((net.sf.saxon.TransformerFactoryImpl) tFactory).getConfiguration(); c.registerExtensionFunction(new FooExtension()); FooExtension: public class FooExtension extends ExtensionFunctionDefinition { private static final long serialVersionUID = -8143237239412146617L; @Override public SequenceType[] getArgumentTypes() { return new SequenceType[] { SequenceType.EMPTY

xsl:key not working when looping through nodeset obtained with xalan:nodeset

半城伤御伤魂 提交于 2019-12-04 07:33:00
I have found a case where xsl:key seems not to be working. I am using XSLT 1 with Xalan (compiled) and this is what is happening: 1.- This works: key named test1 works fine: <xsl:variable name="promosRTF"> <xsl:copy-of select="promo[@valid='true']"/> </xsl:variable> <xsl:variable name="promos" select="xalan:nodeset($promosRTF)" /> <!-- now the key: when defined and used here it works fine: --> <xsl:key name="test1" match="//promo" use="'anytext'" /> <xsl:for-each select="key('test1','anytext')/*"> loop through elements in key... ok, works fine </xsl:for-each> <xsl:for-each select="$promos/*">

how can I tell xalan NOT to validate XML retrieved using the “document” function?

做~自己de王妃 提交于 2019-12-04 06:56:23
Yesterday Oracle decided to take down java.sun.com for a while. This screwed things up for me because xalan tried to validate some XML but couldn't retrieve the properties.dtd. I'm using xalan 2.7.1 to run some XSL transforms, and I don't want it to validate anything. so tried loading up the XSL like this: SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setNamespaceAware(true); spf.setValidating(false); XMLReader rdr = spf.newSAXParser().getXMLReader(); Source xsl = new SAXSource(rdr, new InputSource(xslFilePath)); Templates cachedXSLT = factory.newTemplates(xsl); Transformer

Ant <junitreport> fail because of Xalan's (XSLT) secure processing feature

谁说胖子不能爱 提交于 2019-12-04 06:07:49
My junit tests run via ant 1.7 from within my Eclipse environment but the build failes when the junitreport task is performed: BUILD FAILED .../build.xml:222: Errors while applying transformations: javax.xml.transform.TransformerException: java.lang.RuntimeException: Use of the extension function 'xalan://org.apache.tools.ant.util.StringUtils:replace' is not allowed when the secure processing feature is set to true. I tried to figure out how to make the junitreport task disable the secure processing feature (which I don't need and is only in my way at this point) but I have no clue how since

passing xml nodes/documents/fragments as parameters to xslt

久未见 提交于 2019-12-04 05:13:11
I tried to pass a w3c.dom.Document , Element and NodeList as parameters to a xslt transform. I want to be able to process it within the xslt: <xsl:param name="links" /> <xsl:template match="/"> <record> <xsl:for-each select="$links/*"> <test /> </xsl:for-each> </record> </xsl:template> I pass the parameter as: Document params = createLinksParams(links); transformer.setParameter("links", params); I get this exception: 'Invalid conversion from 'com.sun.org.apache.xerces.internal.dom.DocumentImpl' to 'node-set'.' I tried also exslt:node-set() , xalan:nodeset() etc, but it doesn't work. It seems

getting error in xslt transformation through java

别说谁变了你拦得住时间么 提交于 2019-12-02 23:22:37
问题 I am trying to an xsl transformation that right now by a java object I am generating an intermediary XML and that XML is again passed to generate a new XML finally right now while in xsl transformation I am getting the error, let me show you below my piece of code that I have tried. Below is my class in which first I am creating objects and then through xstream generating the intermediary XML InvoiceReferenceNotificationMessage invoiceReferenceNotificationMessage = new

Using non-core EXSLT date functions with Xalan Java

十年热恋 提交于 2019-12-02 19:51:13
问题 I have had EXSLT's core date functions working well in some XSL templates I've been using for years. I'd like to start using a new one: seconds . This function is not one of the "core" functions and therefore implementations can claim compliance with EXSLT without actually implementing it. I'm using Cocoon 2.1.11 with Xalan 2.7.1 which, it appears, has chosen not to implement date:seconds . Fortunately, the kind folks at EXSLT provide downloads to help you plug-in individual functions but I