Showing results for 
Search instead for 
Did you mean: 

XSL transformation error

Former Member
0 Kudos

Hello everybody,

I'm tryin' to transform a simple xml file via xslt within a simple java class. Following an excerpt of the java class.

TransformerFactory factory = TransformerFactory.newInstance(); 
Transformer transformer = null; 
Templates template = null; 
StreamSource xmlSource = null; 
StreamSource xslSource = null; 
StreamResult result = null; 
try { 
	// a new StreamSource from a file name 
	xmlSource = new StreamSource(new File("Y:\temp\input\index.xml")); 
	xslSource = new StreamSource(new File("Y:\temp\transformation.xslt")); 
	// a new StreamResult to a file name (it is automatically 
	//closed on exit) 
	result = new StreamResult("data/cars1.html"); 
	// get a new Templates object for this stylesheet 
	template = factory.newTemplates(xslSource); 
	// get a new Transformer from the Templates 
	transformer = template.newTransformer(); 
	// perform the transformation 
	transformer.transform(xmlSource, result);
catch(Exception e){

When debugging the class I receive the error message

<b>ERROR: 'Syntax error in '($processedChildren, $nextChild)'.'

FATAL ERROR: 'The template couldn't be compiled.'</b>

The expression mentioned in the error message in an excerpt from the XSLT file. The entire expression in the file looks as follows

<xsl:when test="empty(index-of($processedChildren,$nextChild))">

I'm currently using NetWeaver 2004 with JDK 1.4.

Anybody got any suggestions for this problem? Maybe it's due to the index-of function. I'm not quite sure if it's an XPath 2.0 function.

Thanks in advance,


Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

The problem seems to be that neiter "empty()" nor "index-of()" are XSLT or XPath functions.

Are you using some kind of XSLT extension? (In that case the functions would probably have to be marked as belonging to a different namespace).

What exactly are you attempting to do in that test? What are the types of the variables $processedChildren and $nextChild?



Former Member
0 Kudos

Hi Jens,

processedChildren is a sequence of string objects, nextChild is a string. With the test I'm trying to check whether the string is contained in the sequence. If not, the function empty() returns true. Index-of returns the index numbers of the string, where the string occurs in the sequence.

Both functions are part of the XPath 2.0 standard

<a href=""></a>