2 XML Docs > 1 XSLT Stylesheet

webmasterbeta

New Member
I've posted this question before with no response, so I decided to simplify my explanation in hopes of making it easier to understand what I'm asking about:

I have 2 XML docs:
1) xmldoc1.xml - This file contains a central list of external links for our entire website. This is how it's set up:
<xmldoc1>
<site id="site1">
<url>http://www.site1.com/</url>
</site>
<site id="site2">
<url>http://www.site2.com/</url>
</site>
</xmldoc1>

2) xmldoc2.xml - This file contains a node named "link" that matches one of the "id" attributes from xmldoc1.xml. This is how it's set up:
<xmldoc2>
<item>
<title>SITE 1</title>
<address>123 4th St.</address>
<phone>(123) 456-7890</phone>
<link>site1</link>
</item>
<item>
<title>SITE 2</title>
<address>987 6th St.</address>
<phone>(987) 654-3210</phone>
<link>site2</link>
</item>
</xmldoc2>

And this is what I'd like the output to look like:

SITE 1
Address: 123 4th St.
Phone: (123) 456-7890
Website: <!-- m --><a class="postlink" href="http://www.site1.com/">http://www.site1.com/</a><!-- m -->

SITE 2
Address: 987 6th St.
Phone: (987) 654-3210
Website: <!-- m --><a class="postlink" href="http://www.site2.com/">http://www.site2.com/</a><!-- m -->

I know that I need an XSLT stylesheet that ties the 2 source XML docs together using the "id" attribute from xmldoc1.xml, and the "link" node from xmldoc2.xml, but I'm not sure how to accomplish this. I've been beating my head against a wall concerning what I thought would be a simple task, so I'm now hoping that some knowledgable folks can show me the light so-to-speak.

So if anyone can give me some insight in how to accomplish this task, it would be greatly appreciated!!! Thanks so much for your time.
 
Back
Top