Hi,

While modifying the XsltTransformer for a MULE project, I am trying to pass
XML as an input parameter the JAVA trannsformer but am getting the following
error :

Exception stack is:
1. Invalid conversion from 'org.apache.xerces.dom.DeferredElementImpl' to
'node-
set'. (java.lang.RuntimeException)
  com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary:-1
(http://java.sun.com/j2se/1.5.0/docs/api/java/lang/RuntimeException.html)


Root Exception stack trace:
java.lang.RuntimeException: Invalid conversion from
'org.apache.xerces.dom.DeferredElementImpl' to 'node-set'.
        at
com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary.runTimeE
rror(Unknown Source)
        at
com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary.runTimeE
rror(Unknown Source)


Input XML :

<?xml version="1.0" encoding="UTF-8"?>
<order>
  <clientId>CLT001</clientId> 
  <orderId>ORD001</orderId> 
  <bill>12.5</bill> 
  <deliveryDate>2006-01-11</deliveryDate> 
  <location>001</location>
  </order>


Input Parameter to the stylesheet (also an XML) :

<?xml version="1.0" encoding="UTF-8"?>
<locations>
 <location>
          <name>001</name>
          <value>Bangalore</value>
        </location>
<location>
          <name>002</name>
          <value>Dellhi</value>
        </location>
  </locations>


Stylesheet:

<?xml version="1.0" encoding="ISO-8859-1"?>
<?altova_samplexml C:\Documents and Settings\gaurav_suri\Desktop\Input.xml?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
        <xsl:output method="xml" indent="yes" encoding="ISO-8859-1"
standalone="yes"/>
        <xsl:template match="*">
                <client>
                        <xsl:value-of select="clientId"/>
                </client>
                <ordernumber>
                        <xsl:value-of select="orderId"/>
                </ordernumber>
                <deliverydate>
                        <xsl:value-of select="deliveryDate"/>
                </deliverydate>
                <bill>
                        <xsl:value-of select="bill"/>
                </bill>
                <area>
                        <xsl:value-of 
select="$ORM/locations/location[name=001]/value"/>
                </area>
        </xsl:template>
</xsl:stylesheet>


Code Snippet :

transformer.setParameter(parameter.getKey(),
evaluateTransformParameter(parameter.getKey(),parameter.getValue()));

//where evaluateTransformParameter method returns a document built as
follows :


DocumentBuilderFactory documentbuilderfactory =
DocumentBuilderFactory.newInstance();
InputSource inputsource = new InputSource(new StringReader(s));
org.w3c.dom.Document document =
documentbuilderfactory.newDocumentBuilder().parse(inputsource);       
return document;

//s being the input XML parameter as string.


Any pointers for correction..

Regards
Gaurav

-- 
View this message in context: 
http://www.nabble.com/Passing-XML-as-input-parameter-to-XSLT-Transformer-tf3763982.html#a10639797
Sent from the Xerces - J - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to