emsenthil
asked on
How to pass a Document object as a parameter to XSLT
I am executing a XSLT from Java using this code ::
DocumentBuilder builder;
InputStream defInputStream = this.getClass().getClassLo ader().get ResourceAs Stream("de finitionsd b.xml");
Document definitionsDB = builder.parse(defInputStre am);
Source xslSource = new StreamSource(inputXMLFile) ;
Result xmlResult = new StreamResult(xmlOutputFile Writer);
xmlTransformer.setParamete r("inputFi le", definitionsDB);
xmlTransformer.transform(x slSource, xmlResult);
As you can see, apart from the StreamSource input xml file, I am sending another XML file as a parameter to the XSLT.
I receive the file in XSLT using the <xsl:param name="inputFile"/>
But then, I am not able to use the variable as a normal nodeset variable... like $inputFile/Definition/node 1 ...
Any solution, on how to solve it?
DocumentBuilder builder;
InputStream defInputStream = this.getClass().getClassLo
Document definitionsDB = builder.parse(defInputStre
Source xslSource = new StreamSource(inputXMLFile)
Result xmlResult = new StreamResult(xmlOutputFile
xmlTransformer.setParamete
xmlTransformer.transform(x
As you can see, apart from the StreamSource input xml file, I am sending another XML file as a parameter to the XSLT.
I receive the file in XSLT using the <xsl:param name="inputFile"/>
But then, I am not able to use the variable as a normal nodeset variable... like $inputFile/Definition/node
Any solution, on how to solve it?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.