Subject: Re: Combining Multiple XML Documents From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Wed, 28 Jun 2000 20:10:25 +0100 |
John Greek wrote: >Yes, but, can you have a xsl stylesheet applied to one of these "entitied" >files and produce another xml file that consists of the original files >together (xml + xml) --[xsl]--> xml : When you use entities to give the content of an XML file, then it is treated in exactly the same way as if the XML file held the content of those entities. I'm just going to amend John's combined XML document to avoid confusion: <!DOCTYPE apage [ <!ENTITY banner SYSTEM "authors.xml"> <!ENTITY content SYSTEM "plants.xml"> ]> <authors-and-plants> &banner; &content; </authors-and-plants> The two amendments were firstly to add a document element - every XML document needs one - and secondly to reference the entities within it. Without the references they are not included: it is not enough just to define the entities. This is exactly the same as: <authors-and-plants> <author> <name>...</name> <publisher>...</publisher> </author> <plant> <scientificname>...</scientificname> <location>...</location> </plant> </authors-and-plants> and you can write an XSLT stylesheet that will process it in just the same way, so to get a non-well-formed XML document containing the contents of authors.xml and plants.xml, you can do: <xsl:template match="authors-and-plants"> <xsl:copy-of select="*" /> </xsl:template> If, however, you are just using the entities as a way of identifying the files that you want to combine, a cleaner solution might be to list the files within the XML document, and use document() to access them within XML. For example: <filelist> <file href="authors.xml" /> <file href="plants.xml" /> </filelist> and: <xsl:template match="filelist"> <xsl:for-each select="document(file/@href)"> <xsl:copy-of select="*" /> </xsl:for-each> </xsl:template> Cheers, Jeni Dr Jeni Tennison Epistemics Ltd * Strelley Hall * Nottingham * NG8 6PE tel: 0115 906 1301 * fax: 0115 906 1304 * email: jeni.tennison@xxxxxxxxxxxxxxxx XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Combining Multiple XML Document, John Greek | Thread | sorting & counting, Igor Semenko |
RE: xt:document equivalent in other, Brian Young | Date | Re: XSLT feature request - element , Warren Hedley |
Month |