Hi there,
I have done it using document() fucntion, but now , i want to use jdom and
xsl to achieve it , but I really have no idea how to do it,I suppose i can
use jdom to merge them togther and store it to a new xml file then use xsl
to transfom it ????
thank you very much for any idea and possible solutions !!!the follow are
the files
i have 3 xml documents here, first one is
fellowship:
<?xml version="1.0" ?>
- <fellowship id="1000">
<title>entertainment club</title>
<descr>welcome to this amazing club</descr>
- <members>
- <member id="200201">
<link url="file:// wangning" />
</member>
- <member id="200202">
<link url="file://Derek" />
</member>
</members>
</fellowship>
and the other two have the same structure
one is fellow1.xml
<?xml version="1.0" ?>
<fellow>
<name>ning</name>
<surname>wang</surname>
<email>ilydear(_at_)hotmail(_dot_)com</email>
<resources>
<resource id="001" type="mp3">
<title>hero</title>
<author id="sony">john</author>
<description>famous in uk.</description>
<location url="file://wangning" />
</resource>
<resource id="002" type="mp3">
<title>titanic</title>
<author id="bmw">jane</author>
<description>famous in world!.</description>
<location url="file://wangning" />
</resource>
</resources>
</fellow>
and fellow2.xml
<?xml version="1.0" ?>
- <fellow>
<name>derek</name>
<surname>ben</surname>
<email>derek(_at_)hotmail(_dot_)com</email>
- <resources>
- <resource id="003" type="ebook">
<title>ghost</title>
<author id="uk">tomjohson</author>
<description>written in 1978.</description>
<location url="file://Derek" />
</resource>
- <resource id="004" type="ebook">
<title>angel</title>
<author id="usa">jerry</author>
<description>very good imagination!.</description>
<location url="file://Derek" />
</resource>
</resources>
</fellow>
The question here is how I can merge the two documents using jdom and then
use xsl to transfome it to a new xml file according to the following
given catalogue.dtd!!!
catalogue.dtd
<!ELEMENT catalogue (items)>
<!ATTLIST catalogue id ID #required>
<!ELEMENT items (item)*>
<!ELEMENT item (type, title, author*, description, location, owner)>
<!ATTLIST item id ID #required>
<!ELEMENT type (#pcdata)>
<!ELEMENT title (#pcdata)>
<!ELEMENT author (#pcdata)>
<!ATTLIST author id CDATA #required>
<!ELEMENT description (#pcdata)>
<!ELEMENT location empty>
<!ATTLIST location url CDATA #required>
<!ELEMENT owner empty>
<!ATTLIST owner id CDATA #REQUIRED
url CDATA #required>
_________________________________________________________________
与联机的朋友进行交流,请使用 MSN Messenger: http://messenger.msn.com/lccn/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list