Ken,
I appreciate your help on my previous problem - your solution is working
well!
However - I am now trying to recursively import multiple XML files eg:
You previously advised me to use this "structure" - it works fine...
<!-- employees.xml -->
<!DOCTYPE EMPLOYEES
[
<!ENTITY emp-stuff SYSTEM "employee.xml">
]>
<EMPLOYEES>
<OFFICE name="Town Hall">
&emp-stuff;
</OFFICE>
</EMPLOYEES>
but what I would like to do is extend the entity structure "recursively" -
note "dob-stuff" in the example below...
<!-- employee.xml -->
<!DOCTYPE EMPLOYEES
[
<!ENTITY dob-stuff SYSTEM "dob.xml">
]>
<EMPLOYEE>
<NAME>Jo Blogs</NAME>
&dob-stuff;
</EMPLOYEE>
... and then
<!-- dob.xml -->
<DOB>1-12-1980</DOB>
Well I have been trying this (assuming it is possible!) but the Crimson
parser doesnt seem to like this I am getting the following error message:
org.xml.sax.SAXParseException: The content beginning "<!" is not legal
markup. Perhaps the "!" () character should be a letter.
I'm I asking for "too much" with the physical entity structure or is there
something I'm not doing correctly?
Your help is once again appreciated!
--Chisanga--
From: "G. Ken Holman" <gkholman(_at_)CraneSoftwrights(_dot_)com>
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Importing multiple XML files into one XML file
Date: Tue, 06 Apr 2004 13:31:36 -0400
At 2004-04-06 16:55 +0000, Chisanga Mwelwa wrote:
I want to use XML as a template for an application data source. Now the
problem I have come across is the increasing size of the XML files and I
was wondering whether there is an elegant way in which I can organise my
files.
Use the physical entity structure available for XML documents and external
parsed general entities.
For instance if I have a an XML file such as "employees.xml":
<?--employees.xml-->
<EMPLOYEES>
<OFFICE name="Town Hall">
<EMPLOYEE>
<NAME>Jo Blogs</NAME>
<DOB>1-12-1980</DOB>
</EMPLOYEE>
</OFFICE>
</EMPLOYEES>
Now say I would like to create another file "employee.xml" and use it to
store the data currently in the <EMPLOYEE> tag instead of craming
everything into the "employees.xml" file
That would be the external parsed general entity.
and then (I dont know how...) call this file from the main file:
"employees.xml" file.
That would be the general entity reference.
Is there a way I could achieve this?
An example is below; I hope this helps.
.................... Ken
p.s. I use this extensively in my prose writing of my books and training
material because it allows me to maintain modules, lessons and frames in
separate XML fragments, referenced through a tree of entity references, as
separate objects in my source code control system ... I don't have to check
out an entire module just to change a single paragraph.
p.p.s. do not be lured into using external parsed general entities for
information sharing ... only for the fragmentation of a single large
instance into portions ... use the document() function in XSLT for
information sharing as the general entity approach is far too fragile to
use in a production environment
T:\ftemp>type employees.xml
<!DOCTYPE EMPLOYEES
[
<!ENTITY emp-stuff SYSTEM "employee.xml">
]>
<EMPLOYEES>
<OFFICE name="Town Hall">
&emp-stuff;
</OFFICE>
</EMPLOYEES>
T:\ftemp>type employee.xml
<EMPLOYEE>
<NAME>Jo Blogs</NAME>
<DOB>1-12-1980</DOB>
</EMPLOYEE>
T:\ftemp>type chisanga.xsl
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="@*|node()"><!--identity for all other nodes-->
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
T:\ftemp>saxon employees.xml chisanga.xsl
<?xml version="1.0" encoding="utf-8"?><EMPLOYEES>
<OFFICE name="Town Hall">
<EMPLOYEE>
<NAME>Jo Blogs</NAME>
<DOB>1-12-1980</DOB>
</EMPLOYEE>
</OFFICE>
</EMPLOYEES>
T:\ftemp>
--
Public courses: Spring 2004 world tour of hands-on XSL instruction
Each week: Monday-Wednesday: XSLT/XPath; Thursday-Friday: XSL-FO
Hong Kong May 17-21; Bremen Germany May 24-28; Helsinki June 14-18
World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc
--+------------------------------------------------------------------
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>
--+--
_________________________________________________________________
Express yourself with cool new emoticons http://www.msn.co.uk/specials/myemo