xsl-list
[Top] [All Lists]

Re: Re: Merging multiple xmls into a single xml

2005-07-25 09:22:03
Hi At 02:24 PM 7/22/2005, iwantto keepanon wrote:
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?

It's not a bad solution -- and it has been offered, though not recently, and though in answer to a slightly different question. See http://www.biglist.com/lists/xsl-list/archives/200411/msg01016.html.

The reason it's not the *best* answer is probably that it's insufficiently general. Due to a weakness in XML's design -- differences in definition between a "document" and a "well-formed external parsed general entity" -- it won't work in all cases; in particular, you won't be able to do it when any "subdocuments" have DOCTYPE declarations.

Cheers,
Wendell



--~------------------------------------------------------------------
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>
--~--


======================================================================
Wendell Piez                            
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


--~------------------------------------------------------------------
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>
--~--