You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by "Kusunam, Srinivas" <SK...@rlpt.com> on 2005/10/07 19:57:20 UTC

Reading XMLString Object in XSLT document function

Hi Group,

I have 2 XML Documents which I need to parse and produce 3rd XML.

First XML is a physical file say 'firstXML.xml'
Second XML is coming as String Object.

How do I use this 2nd XML as String object in 'document()' function in
my XSL stylesheet. 

Options Tried:

1) In Java Class where we I read the inputs and outputs I have created a
Param on Transformer
String stringXML2= "<parent><child> Hello </child></parent>";
i.e. transformer.setParameter("xmlTWO",stringXML2); 

and in XSL	
<xsl:param name="xmlTWO" />
<xsl:variable name="aggregator" select="document($xmlTWO)" />
-------------------This Doesn't Work-------------

2) I have converted 2nd XML String Object in to XNodeSet and set as
Parameter.
DocumentBuilder dBuilder = dFactory.newDocumentBuilder();
	------
Node rootNode = (Node)document.getDocumentElement();
XNodeSet xNodeSetXML2 = new XNodeSetForDOM(rootNode, new
DTMManagerDefault());
transformer.setParameter("xmlTWO", xNodeSetXML2);

Using same XSL
-------------------This Doesn't Work-------------

I am sure I might be doing wrong in both the cases. Please let me know
how to achieve this task.

Thanks,
Srinivas