[xslt] libxslt and xslt document( ) function



Hi,
I'm rephrasing my previous post reg. merging xml's using merge.xslt.

How do I pass a DOM tree pointer, which I get after parsing the xml file,
to the XSLT document( ) function. Any idea of this will be very much helpful to me.

The original post is as below,

Thanks.
Senthil Nathan R

--------------------------------------------

Hi,
I'm trying to merge 2 or more XML's to form a single XML
using "merge.xslt", from the foll. link,
  http://www2.informatik.hu-berlin.de/~obecker/XSLT/#merge

I'm doing this using libxslt. I need to specify the static file names as,
merge.xml ---->
 <merge xmlns="http://informatik.hu-berlin.de/merge">
     <file1>file1.xml</file1>
     <file2>file2.xml</file2>
  </merge>

Suppose if I have the DOM tree of those files in memory, how
should I need to use merge.xslt to merge the trees in memory??
 
Actually in merge.xslt, the files specified are accessed as,
 <xslt:call-template name="m:merge">
     <xslt:with-param name="nodes1"
  select="document($file1,/*) /node()" />
     <xslt:with-param name="nodes2"
 select="document($file2,/*)/node()" />  </xslt:call-template>
 
Using libxslt api's the stylesheet is applied on the xml as,
       cur = xsltParseStylesheetFile((const xmlChar *)"merge.xslt");
       doc = xmlParseFile("merge.xml ");
       res = xsltApplyStylesheet(cur, doc, params);

So, how can I pass the two input DOMs to the sylesheet as parameters and
replace the calls on document() by references to the parameters using LIBXSLT.
 
Thanks
Senthil


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]