[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: merging xml's using XSLT, merge.xslt
Senthil Nathan wrote:
Hi,No problem. Sometimes it is good to wait a while and see whether or not your message shows on the list. Also, you can start subsequent messages with something like "new try, perhaps it is a copy, but the first gave me an error" or something like that.
Consider downloading and using Kernow. It is meant for this kind of thing: running multiple xslt stylesheets against multiple documents.
I see, but aren't you making something that's supposed to be simple awkwardly hard? It is a nice challenge to do something like this, but really, I have no knowledge of the inner workings of libxslt. I am sure I can find out when I'd create my own C++ project and when I use the original sources of libxslt, but unfortunately I lack the time and the interest to do so (I like to move on and use Saxon rather, which is XSLT 2.0, if that has a missing feature, I kindly ask Michael and more often than not he shows me how to do it with the product that's already there). ---> so, otherwise how do I merge several xml files using the xslt library api's in cpp. And is there any examples can you send me, which would read the document URI's and use it for merging xml's. Well, the easiest thing I can think of is something like the following. Place this in 'merge-catalog.xml': <mergable-docs base-uri="file:///c:/temp/"> <doc uri="my-relative-uri.xml" /> <doc uri="my-relative-uri-2.xml" /> </mergable> Then, in your xslt you would do something like this: <xsl:variable name="mergethese" select="document('merge-catalog.xml')" /> <xsl:template match="/" > <xsl:variable name="base-uri" select="$mergethese/mergable/@base-uri" /> <xsl:for-each select="$mergethese/mergable/doc"> <xsl:apply-templates select="document(concat($base-uri, @uri))" /> </xsl:for-each> </xsl:template> <xsl:template match="somenode-from-mergabledoc" > ...... </ Then you are very flexible and you can do whatever you want. Of course, if all you want to do is just to concatenate the documents, instead of apply-templates, you can also use xsl:copy-of.with a supplied root-element around the bunch. HTH, Cheers, -- Abel Braaksma
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|