Get error for running  the java extension of XSLTC example  posted on 
http://xml.apache.org/xalan-j/extensions_xsltc.html.

 

Appreciate any comments or  good example !

 

Work environment: java 5 and xalan_j_2_7_1

 

Exception in thread "main" java.lang.VerifyError: (class:
extension_java, method: template$dot$0 signature: (Lorg/apache

/xalan/xsltc/DOM;Lorg/apache/xml/dtm/DTMAxisIterator;Lorg/apache/xml/ser
ializer/SerializationHandler;I)V) Expecting to f

ind double on stack

        at java.lang.Class.getDeclaredConstructors0(Native Method)

        at
java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)

        at java.lang.Class.getConstructor0(Class.java:2699)

        at java.lang.Class.newInstance0(Class.java:326)

        at java.lang.Class.newInstance(Class.java:308)

        at
org.apache.xalan.xsltc.trax.TemplatesImpl.getTransletInstance(TemplatesI
mpl.java:340)

        at
org.apache.xalan.xsltc.trax.TemplatesImpl.newTransformer(TemplatesImpl.j
ava:369)

        at
org.apache.xalan.xsltc.trax.TransformerFactoryImpl.newTransformer(Transf
ormerFactoryImpl.java:619)

        at TestExtension.process(TestExtension.java:21)

        at TestExtension.demo(TestExtension.java:12)

        at TestExtension.main(TestExtension.java:37)

 

Partial  source codes are listed below:

 

public class TestExtension {

               

               public static void demo(){

                              String xmlInURI="extension.xml";

                              String xslInURI="extension_java.xsl";

                              process(xmlInURI,xslInURI);

               }

               public static void process(String xmlInURI,String
xslInURI){

                              try

                   {

                     // Instantiate the TransformerFactory, and use it
along with a SteamSource

                     // XSL stylesheet to create a Transformer.

                     

                               TransformerFactory tFactory =
TransformerFactory.newInstance();

                    Transformer transformer =
tFactory.newTransformer(new StreamSource(xslInURI));

                    // Perform the transformation from a StreamSource to
a StreamResult;

                     transformer.transform(new StreamSource(xmlInURI),

                                           new
StreamResult((System.out)));  

                   }

                   catch (Exception e) 

                   {

                    e.printStackTrace();

                   }      

               }

               

               public static void main(String args[]){

                              String
key="javax.xml.transform.TransformerFactory";

                              //String
value="org.apache.xalan.processor.TransformerFactoryImpl";

                              String
value="org.apache.xalan.xsltc.trax.TransformerFactoryImpl";

                              System.setProperty(key, value);

                              demo();

               }

}

<xsl:stylesheet version="1.0"

    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";

    xmlns:date="http://xml.apache.org/xalan/java/java.util.Date";

    xmlns:java_lang="http://xml.apache.org/xalan/java/java.lang";

    exclude-result-prefixes="date java_lang">

 

  <!--

  * test: construction of Date object using a parameter calculated

  *       by a static call to the java.lang.Math object. Then call

  *       a non-static method (getTime()) on the newly created Date

  *       object. Demonstrates calling constructors, static functions

  *       (Math.max) and non-static functions (getTime()).

  *

  * Output:

  *   <?xml version="1.0" encoding="UTF-8"?>

  *     Date of object: Sat Nov 30 17:32:41 EST 2002

  *     Time of object: 1038695561000

  *

  -->

 

  <xsl:template match="/">

   <!-- create Date object with calculated parameter -->

   <xsl:variable name="dateObject"

     select="date:new(

         java_lang:Math.max(1027695561000,1038695561000)

     )"/>

   Date of object: <xsl:value-of select="$dateObject"/>

   Time of object: <xsl:value-of select="date:getTime($dateObject)"/>

  </xsl:template>

 

  </xsl:stylesheet>

 

 

 

 

Jing Yang

Software Engineer 

jy...@jbmanagement.com <mailto:jy...@jbmanagement.com> 

 

 

 

 

 

12 Christopher Way, Suite 103

Eatontown, NJ 07724

PH:  732-542-9200, ext. 233

FAX:  732-380-0678

www.jbmanagement.com <http://www.jbmanagement.com> 

 

CONFIDENTIAL NOTICE:

This electronic mail transmission is confidential, may be priviledged
and should be read or retained only by the intended recipient. If you
have received this transmission in error, please immediately notify the
sender and delete it from your system.

 



This document may contain technical data which is controlled by the US 
Department of State. In accordance with the International Traffic in Arms 
Regulations (ITAR) the data herein may not be exported or transferred to a 
foreign national, inside or outside the US or to a foreign company unless 
authorized by the US State Department. Unauthorized disclosure or use of this 
data is strictly prohibited. If you received this message in error or are 
unsure whether such data is protected by law, please contact the sender.

<<image001.jpg>>

Attachment: TestExtension.java
Description: TestExtension.java

<?xml version="1.0"?>
<doc>
  <name first="David" last="Marston"/>
  <name first="David" last="Bertoni"/>
  <name first="Donald" last="Leslie"/>
  <name first="Emily" last="Farmer"/>
  <name first="Joseph" last="Kesselman"/>
  <name first="Myriam" last="Midy"/>
  <name first="Paul" last="Dick"/>
  <name first="Stephen" last="Auriemma"/>
  <name first="Scott" last="Boag"/>
  <name first="Shane" last="Curcuru"/>
</doc>

Attachment: extension_java.xsl
Description: extension_java.xsl

Reply via email to