xsl-list
[Top] [All Lists]

Re: Merging multiple xmls into a single xml

2005-07-22 11:24:09
(I think I sent this from a non-subscribed email address, so I am resending ... 
never saw it come into 
the list)


"Neelam Joshi" <mneelam(_at_)gmail(_dot_)com> writes:

I want to merge multiple xmls into a single xml. Here are the details:


See Example 1 "parsed entities" @ http://www.topxml.com/code/default.asp?
p=3&id=v20030524142328&ms=20&l=xslt&sw=All

Basically this is your XML:
   <?xml version="1.0" encoding="utf-8"?>
   <!DOCTYPE allproducts [
      <!ENTITY resourceA SYSTEM "ProductSalesSW.xml">
      <!ENTITY resourceB SYSTEM "ProductSalesNW.xml">
   ]>
   <allproducts>
      &resourceA;
      &resourceB;
   </allproducts>

And this could be your XSLT:
   <?xml version='1.0' encoding='utf-8' ?>
   <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
   <xsl:output method="xml" indent="yes"/>

   <xsl:template match="/">
      <xsl:apply-templates />
   </xsl:template>

   <xsl:template match="allproducts">
      <xsl:element name="products" >
         <xsl:copy-of select="." />
      </xsl:element>
   </xsl:template>

   </xsl:stylesheet>

(full listings, discussion, and XML input files at URL.)

You could write a small quick CGI (bash, perl, anything) to generate
the XML file based on files/directories.  Then the XSLT script would
take it from there w/o document() function calls.

My question to the list is, why hasnt this been offered as a solution
to several recent queries like "how do i combine .... ?".  Is this a
good solution?

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--