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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple XMLs for one XSL 2

Status
Not open for further replies.

gregmosu

Programmer
Jul 8, 2002
117
US
I'm using Oxygen as the xml generator, and so far I've had no trouble using an xsl stylesheet and an xml file to create an html file, but what I would like to do is use data from multiple xml files together with one xsl to create an html file...

ex)

company.xml + personel.xml + style.xsl = company_personel.html

Is this possible? So far, I only see a way combile one xml file and one xsl file.

Thanks,
Greg
 
Have a look at the xsl:document() function. It
can provide the functionality that you are
looking for.
 
So, assuming that company.xml is the main xml file for that particular stylesheet and my style sheet looks like this...

<xsl:stylesheet xmlns:xsl=" version="1.0">
<xsl:template match="/company">
<html>
<head>
<title>
<xsl:value-of select="title"/>
</title>
</head>
<body>
<p><xsl:value-of select="message"/></p>

<xsl:variable name="per" select="document('person.xml')"/>
<p><xsl:value-of select="$per/@name"/></p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Then the code right before the </body> tag should access data from person.xml, which looks like this...

<person>
<title>CEO</title>
<name>Mr. Smith</name>
</person>


After trying the trasnformation, I dont get any errors.. but it doesnt generate the name either. What am I doing wrong?

THanks,
Greg
 
The <name> of your person is not an attribute, but a childnode.
<xsl:value-of select="$per/@name"/>
should be:
><xsl:value-of select="$per/name"/></p>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top