Re: [xsl] merging xml's using XSLT, merge.xslt

Subject: Re: [xsl] merging xml's using XSLT, merge.xslt
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Fri, 14 Sep 2007 20:22:47 +0200
Senthil Nathan wrote:
Hi Abel,
I have been using libxslt, libxml2 and its api's. I know that the xslt file and the xml file will be parsed by libxslt and the stylesheet will be applied over that. (There is a thread before this, where I have said abt merge.xslt and merge.xml)

I know, I read all messages on this list.


But I wanted to know more about "passing parameters to XSLT". I'm merging 2 or more XML's and for which I specify the static file names. Instead I wanted to give the DOM tree as input to the XSLT.

well, you can trick it the easy way like I suggested, because in libxslt every param is an xpatch. If you pass it in a parameter that looks like a correct document('') call you are in fact passing in a DOM tree. That was why I suggested it.



Mike Suggested as below, but I'm not sure how to do that.

Yes, I responded to that. There are more ways that lead to Rome. The easy way is using the command line. The harder way is by using the API. I don't know in what context you are using libxslt, but when you want to extend the system, you can simply use the API. Probably not so simple, depends on how handy you are with Java or c++. some info can be found here: http://xmlsoft.org/XSLT/html/libxslt-xsltInternals.html and some other info can be found here: http://xmlsoft.org/XSLT/tutorial/libxslttutorial.html#parameters


But from what I read here, it does in code about the same as you can do on the commandline. Depending on how much you want to invest in it, I suggest you take this very specific question to the libxslt list.

In short: a DOM node can only be given to libxslt with an XPath and all possibilities you have there, or you'll have to program the interfaces.

Sorry that I cannot be of more help. If you want an easier solution, use Saxon.

Cheers,

-- Abel Braaksma

Current Thread