xalan

AbstractMethodError on org.apache.xalan.processor.TransformerFactoryImpl

With the following code: private Document transformDoc(Source source) throws TransformerException, IOException { TransformerFactory factory = TransformerFactory.newInstance(); factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); factory.setFeature("http://xml.org/sax/features/validatio...

java.io.IOException: Server returned HTTP response code: 503 for URL: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd

In the following code: private Document transformDoc(Source source) throws TransformerException, IOException { TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(new StreamSource(xsltResource.getInputStream())); JDOMResult result = new JDOMResult(); ...

Improve XPath efficiency for repeated, parameterized queries / Xalan selectSingleNode() method

Hi, I am repeatedly performing the following XPath query (though parameterized by 'keywordText') around 40,000 times: String query = SystemGlobal.YAHOO_KEYWORDSSUBNODE + "/" + SystemGlobal.YAHOO_KEYWORDNODE + "[" + SystemGlobal.YAHOO_ATTRKEYPHRASE + "='" + keywordText + "']"; CachedXPathAPI cachedXPathAPI = new CachedXPathAPI(); NodeIt...

Cannot access updated Java object from Saxon XSLT processor

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...

Leave entity intact in XML + XSLT

I transform XML to (sort of) HTML with XSL stylesheets (using Apache Xalan). In XML there can be entities like &mdash;, which must be left as is. In beginning of XML file I have a doctype which references these entities. What should I do for entity to be left unchanged? <!DOCTYPE article [ <!ENTITY mdash "&mdash;"><!-- em dash --> ]> ...

Docbook+Ant: Could not find variable with the name of fop.extensions

After a lot of spent time trying to get my article to compile in Ant with Docbook, I can't seem to make FO compilation work. I'm using Xalan 2.7.0, and everything else (both single-page and chunked HTML) compiles perfectly. It's only when I try to compile to FO that I get this error: Fatal Error! org.apache.xml.utils.WrappedRuntimeExce...

Problems with Xalan and Java JDK 1.5

From what I believe and have read online. Sun has decided to include Xalan in JDK 1.5. I am trying to take advantage of this and try to perform an XSLT to spit out multiple files. The problem I encounter: 'Unrecognized XSLTC extension 'org.apache.xalan.xslt.extensions.Redirect:write''" From what I have read on google that i needed to c...

Integrate Webservice into Java.

Edit: Sorry guys, realised I have no idea when it comes to integrating Webservices in Java. Was hoping someone could point me in the right direction. Original question: Hey everyone, I was wondering if you guys could point me in the right direction for this. I am required to find out how to inject data into an XML being created. I am u...

Xalan redirect:write , use either of two element values to create name of new .xml file depending on null values.

So I have the following code: <redirect:write select="concat('..\\folder\\,string(filename),'.xml')"> Where "filename" is a tag in the xml source. My problem occurs when filename is null or blank. And this is the case for several of the xml filename tags. So what I am trying to implement is a checking method. This is what I have done:...

Building xalana 1.11 using ICU - Mac

Hi Everybody, Has anybody compiled xalan 1.11 using ICU? I am building it using ICU and its generating one library called libxalanMsg.111.0.dylib and its being generated using the below mentioned steps ============ /tmp/brijesh/ICU//bin/genrb -p xalanMsg -d ../../../nls/icu-i ../../../nls/icu ../../../nls/icu/en_US.txt echo ../....

Xalan (XSLT) translate method translating more than it should.

Hi everyone, I seem to be having an issue with Xalan's translate method. I have the following code: translate(translate(string(name),'&lt;sup&gt;',''),'&lt;/sup&gt;','') This is used to remove <sup> and </sup> from string(name). Unfortunately when I do that, it seems to remove s, u and p from the names as well. So names like sony Bra...

Read XML, Replace Text and Write to same XML file via Java

Hi everyone, Currently I am trying something very simple. I am looking through an XML document for a certain phrase upon which I try to replace it. The problem I am having is that when I read the lines I store each line into a StringBuffer. When I write the it to a document everything is written on a single line. Here my code: File xm...

XALAN register Extension Function like in SAXON

Hi, 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.registerExtensionFunctio...

Remove special characters from XML via XSLT only for specific tags

Hi everyone, I am having a certian issue with special characters in my XML. Bascially I am splitting up an xml into multiple xmls using Xalan Processor. When splitting the documents up I am using their value of the name tag as the name of the file generated. The problem is that the name contains characters that arent recognized by the ...

Extract the first letter of every word in sentence and make it into one word via XSLT

Hi everyone :D, I am trying to extract the first letter of every word for a sentence to form an one word via XSLT. Sample Input `ABC HBO ORACLE 123 (Hello Person)` Expected Output: AHO123HP Thanks in advance :). P.S. I am also using the XALAN Processor. ...

Getting error while using Javascript in XSL

Hi, I've an XML document and I am creating another XML using XSL. I need to check some specific conditions and for that I want to use Javascript in my XSL. I tried it, however, couldn't get the desired result. As I could not change the XSL variables frequiently so i am trying to use Javascript. XSL- <?xml version="1.0" encoding="UTF-8...

XSLT an XML such that everything is the same except one section.

Hi everyone, Just a quick question. I have one XML and I was hoping to tranform only a section of it without changing anything else. Here is a quick example of what I am looking to do: Input: <?xml version="1.0" encoding="UTF-8"?> <dita xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/" xmlns:xsi="http://www.w3.org/2001/XM...

Why can't I use values of nodes I retrieve by using exsl:node-set/set:distinct in an XPath-Expression?

Hello there. In a xslt-stylesheet I'm using the methods exsl:node-set and set:distinct to access and filter unique nodes from a variable that contains a result tree fragment. I can write the values of these nodes into my output file, example: <xsl:variable name="myNodes"> <xsl:call-template name="getNodes"/> </xsl:variable> <xsl:for...

Problem: sporadic NPE when using XALAN transformer to return HTTP response

Hi, In my tomcat server, I'm trying to return an XML response by writing the response to the servlet's output stream, using a XALAN identity transformer. The XML is valid, but from time to time I'm getting a NPE inside the transformer: WARNING java.lang.NullPointerException at org.apache.xalan.transformer.TransformerIdentityImpl.c...

String functions missing in Xalan 2.7, java.lang.String used instead?!

I am using Xalan 2.7.0 (as bundled with Apache FOP 1.0) and have problems when using string functions. The line <xsl:value-of select="fn:replace('test', 't', '*')"/> results in this exception: javax.xml.transform.TransformerException: java.lang.IllegalArgumentException: argument type mismatch at org.apache.fop.cli.InputHandler.tran...