[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XSl using XALAN - problem:

Subject: XSl using XALAN - problem:
From: Angeshwar Deepak <angeshwar@xxxxxxxxx>
Date: Tue, 1 Jun 2004 04:39:53 -0700 (PDT)
java.lang.classnotfoundexception com ibm bsf bsfma
XSl using XALAN - problem:

Hi,

I am using xalan parser to convert xml
to HTML using xsl.

The code is as follows 

XML file:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="results.xsl"?>
<entries gameID="DWO">
    <entry>
        <player>John</player>
        <guess>3</guess>
        <guess>9</guess>
        <guess>222</guess>
    </entry>
    <entry>
        <player>Mary</player>
        <guess>88</guess>
        <guess>76</guess>
        <guess>5</guess>
    </entry>
</entries>

XSL file:

<?xml version="1.0"?> 
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
               
xmlns:lxslt="http://xml.apache.org/xslt"
               
xmlns:result="http://www.example.com/results"
                extension-element-prefixes="result"
                version="1.0">

  <lxslt:component prefix="result" elements="rules"
functions="getResult">
    <lxslt:script lang="javascript">
        function getResult (thisGuess) {
          var thisResult =
parseInt(Math.random()*100);
          if (thisResult == parseInt(thisGuess)) {
             return "Correct!";
          } else {
             return "Wrong! The actual answer was
"+thisResult+
                                                 ",
not "+thisGuess+".";
          }
        }
    </lxslt:script>
  </lxslt:component>

<xsl:template match="/">
      <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="entry">
      Guesser: <xsl:value-of select="player"/>
      <xsl:apply-templates select="guess"/>  
  </xsl:template>

  <xsl:template match="guess">
        Guess: <xsl:value-of select="."/> 
          Actual: <xsl:value-of
select="result:getResult(string(.))"/>
  </xsl:template>
</xsl:stylesheet>


I have put the following files in the lib
directory of Ant build.

1)xml-apis.jar
2)xercesImpl.jar
3)xalan.jar
4)styler.jar
5)bsf.jar
6)js.jar

and i have included the lib directory in the
classpath.

if i run a code without a javascript function it works
fine,
but with the javascript i get the error

D:\deepak\buildProcess_2\logging>java
org.apache.xalan.xslt.Process -IN
D:\deepak\buildProcess_2\logging\cart.xml -XSL
D:\deepak\buildProcess_2\logging\res
ults.xsl -OUT
D:\deepak\buildProcess_2\logging\xalan.html

java.lang.ClassNotFoundException:
com/ibm/bsf/BSFManager
...
...
...
Caused by: javax.xml.transform.TransformerException:
Could not initialize BSF Manager
        at
org.apache.xalan.extensions.ExtensionHandlerGeneral.<init>(Unknown
Source)
...
...
...
file:/D:/deepak/buildProcess_2/logging/results.xsl;
Line #33; Column #-1; XSLT Error
(javax.xml.transform.TransformerException):
java.lang.NullPointerExcep
tion


So something must be wrong with the bsf.jar file.
where should i put the file so that its being
recognised?
the js.jar file is also at the right place.
where am I wromg?

bye,
with regards,
Deepak.


	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.