passing variables frm xsl to a java method
here is my current frustration -- aside from being new to java and xsl...
i have an xml message (that is passed to me from another process) as follows:
<?xml version="1.0" encoding="UTF-8"?>
<WillsXMLStart>
<inputEventStart>TRUE</inputEventStart>
<inputEventNumber>1</inputEventNumber>
<inputEventID>HEREISTHEID</inputEventID>
<inputEventEnd>TRUE</inputEventEnd>
</WillsXMLStart>
ok now i am using netbeans to create and xsl to gram the information and reformat the information because the end process want the data and event tags differantly. my xsl is as follows:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:gng="java:GetAndConvert"
exclude-result-prefixes="gng"
version="2.0">
<xsl:outputencoding="UTF-8" indent="yes" method="xml"/>
<xsl:template match="/">
<WillsXMLStart>
<inputEventStart>
<xsl:value-of select="WillsXMLStart/inputEventStart"/>
</inputEventStart>
<inputEventNumber>
<xsl:value-of select="WillsXMLStart/inputEventNumber"/>
</inputEventNumber>
<inputEventID>
<xsl:variable name="inputVariable">
<xsl:value-of select="WillsXMLStart/inputEventID"/>
</xsl:variable>
<!-- <xsl:value-of select="$inputVariable"/> -->
<xsl:value-of select="gng:getString('$inputVariable')"/>
</inputEventID>
<inputEventEnd>
<xsl:value-of select="WillsXMLStart/inputEventEnd"/>
</inputEventEnd>
</WillsXMLStart>
</xsl:template>
</xsl:stylesheet>
ok... now for the frustrating part... what i need to do is (as the code shows(i think)), get and store in a variable called "inputVariable" the specific informati that is stored in the "inputEventID" from the xml. that works fine... but i need to pass that information as a string to the java method "getString(String inputVariable)".... my java code (just a test) is as follows:
/*
* GetAndConvert.java
*
* @author william
* Created on June 27, 2007, 8:04 AM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
publicclass GetAndConvert{
/** Creates a new instance of GetAndConvert */
public String getString(String inputVariable){
String x ="test";
System.out.print("this is the string that is hardcoded into GAC: " + inputVariable);
return x;
}
}
OK.... i am getting the following error when i try to run the whole thing -- translation from within XSL:
XML validation started.
Checking file:/home/william/PROGRAMMING/TestingJavaXML/src/testingXML-JavaInput.xsl...
Cannot findclass'java:GetAndConvert'.
Cannot find external method'java:GetAndConvert.getString' (must bepublic).
Could not compile stylesheet
i have 2 packages in my "project". 1 = default where i have my xml and xsl files... 2 = JavaEvents where i have my .Java file.
any and all help would really be appreciated... as i am going bald trying to figure this out. you can either post here or you can email me at: william.gray@thermofisher.com
thanks in advance for all your help.
Deathsbain.

