It's not a secret anymore!*
The moose likes XML and Related Technologies and the fly likes Problem while upgrading from XSLT 1.0 to XSLT 2.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Problem while upgrading from XSLT 1.0 to XSLT 2.0" Watch "Problem while upgrading from XSLT 1.0 to XSLT 2.0" New topic
Author

Problem while upgrading from XSLT 1.0 to XSLT 2.0

Abhijith Prabhakar
Ranch Hand

Joined: Dec 29, 2006
Posts: 56
I am working on up gradation of XSLT 1.0 to XSLT 2.0 in JAVA. We are using xercesimpl jar for conversion.

In xslt 1.0 I was creating a variable with complex data type. For example,

and was accessing it by using:
<xsl:value-of select="xalan:node-set($empDetails/NAME)" />

Since in XSLT 2.0 RTF's have been removed I am trying to accessing the node directly
<xsl:value-of select="$empDetails/NAME" />

It gives an error while trying to access like above. In xslt debugger it doesn't give much information. It just says.
org.apache.xpath.objects.XRTreeFrag - org.apache.xpath.objects.XRTreeFrag

When I looked into logs of application I found:

Caused by: javax.xml.transform.TransformerException: java.lang.RuntimeException: Invalid conversion from 'com.sun.org.apache.xalan.internal.xsltc.dom.SAXImpl' to 'node-set'.
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:647)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:279)
Can someone please let me know how to solve this issue?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Which of the software components you are using support XSLT 2.0, and which don't support it?
Abhijith Prabhakar
Ranch Hand

Joined: Dec 29, 2006
Posts: 56
Hi,

I am using below schema definitions:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan-j" xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:cal="xalan-j://java.util.GregorianCalendar">

I am using xalan-j 2.7.1 jars for generating output(in turn xercesimpl 2.9.2)
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Abhijith Prabhakar wrote:I am using xalan-j 2.7.1 jars for generating output(in turn xercesimpl 2.9.2)


Which of those two components supports XSLT 2.0?
Abhijith Prabhakar
Ranch Hand

Joined: Dec 29, 2006
Posts: 56
Hi Paul,

Thanks paul, I researched through the net and found that none of these component support xslt 2.0 . Found that only free source which supports xslt 2.0 is Saxon right now. Our team will decide to move on to saxon from xalan or not.

You can find that discussion here

Thanks a lot!!!

Regards,
Abhijith P
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem while upgrading from XSLT 1.0 to XSLT 2.0