[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Combining Multiple XML Documents
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) ----> 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
|
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
|