[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Merging multiple xmls into a single xml
Hi,
Tempore 09:05:14, die 07/15/2005 AD, hinc in xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit Neelam Joshi <mneelam@xxxxxxxxx>: The number of input xmls is not fixed, it may vary. So is it possible to accept more than one input file to an xsl script? yes, take a look at this stylesheet: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output indent="yes"/> <xsl:param name="sources">file1.xml|e:/temp/file2.xml|xml3</xsl:param> <xsl:template match="/"> <modulenames> <xsl:call-template name="loaddocuments"/> </modulenames> </xsl:template> <xsl:template name="loaddocuments"> <xsl:param name="string" select="concat($sources,'|')"/> <xsl:if test="substring-before($string,'|') != ''"> <xsl:apply-templates select="document(substring-before($string,'|'))" mode="merge"/> </xsl:if> <xsl:if test="contains($string,'|')"> <xsl:call-template name="loaddocuments"> <xsl:with-param name="string" select="substring-after($string,'|')"/> </xsl:call-template> </xsl:if> </xsl:template> <xsl:template match="/" mode="merge"> <xsl:copy-of select="//module"/> </xsl:template> </xsl:stylesheet> This will load all files specified in the 'sources' parameter and copy their 'module' nodes. regards, -- Joris Gillis (http://users.telenet.be/root-jg/me.html) Spread the wiki (http://www.wikipedia.org)
|
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
|