Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Content from other XML files?

Status
Not open for further replies.

Angel2228

Programmer
Feb 22, 2001
26
US
Let's say that I have two xml files. part of the first document contains information that is repeated in the second. I would like to save myself the trouble of having to enter this information again into the second document...is there a way that i can just reference the section of the first document so that when i go to write my xsl it will display properly?

Just an example....DOC1 contains a list of CDs. DOC2 has a different list, but contains 2 CDs that are the same as DOC1. can i just reference the elements in DOC1 instead of having to enter them again in DOC2?

Thanks.
 
if you were processing DOC2 and it had the entry....

<cd>
<title>Since I Left You</title>
</cd>

and then in DOC1 you had a more detailed...

<cd>
<title>Since I Left You</title>
<artist>Avalanches</artist>
</cd>


then while processing DOC2 you could say

<xsl:template match=&quot;cd&quot;>
<xsl:variable name=&quot;title&quot; select=&quot;title&quot;/>
<xsl:value-of select=&quot;document('DOC1.xml')/myCDs/cd[title=$title]&quot;/>
</xsl:template>

If you have a large music collection tho doing things like this will become very inefficient, especially if you have one big file being used as an index.
 
Well, i don't have one big index file, but rather a fairly large number of different xml files that have certain parts that may be duplicated. and because of the volume of these documents (and time constraints), it would save me time on data entry if i could just reference the info.

is there a way to do this in the .xml file itself? i ask this because my .dtd allows for an 'external content link' tag that i assume can only be used for this purpose. basically what i need is for the a whole node to display as if it were part of the original document.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top