[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
At 2004-04-06 16:55 +0000, Chisanga Mwelwa wrote:
Use the physical entity structure available for XML documents and external parsed general entities.
That would be the external parsed general entity.
That would be the general entity reference.
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
<OFFICE name="Town Hall">
&emp-stuff;
</OFFICE>
</EMPLOYEES>
<OFFICE name="Town Hall">
</OFFICE>
Re: [xsl] Importing multiple XML files into one XML file
Subject: Re: [xsl] Importing multiple XML files into one XML file From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxx 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Selecting Top 10, Michael Kay | Thread | Re: [xsl] Importing multiple XML fi, Chisanga Mwelwa |
RE: [xsl] Comparing grouping techni, Michael Kay | Date | Re: [xsl] DOCTYPE causes appearance, Eliot Kimber |
Month |