Solved

Create XML / XSLT page with two data sources

Posted on 2007-04-11
1
209 Views
Last Modified: 2013-11-18
i have created a XSLT page with data from a simple XML file.

Now, in that XSLT page i want to merge data from 2 XML files, first one contains data for navigation menu, second XML file contains data for teh report section, how can i merge both data sources in the same XSLT file?, (obviusly i can do it in asp or asp.net in teh server side, i want do it at client side).

The xml could be like:

///data for navigation menu (links.xml)
<links>
  <link>link 1</link>
  <link>link 2</link>
  <link>link 3</link>
</links>



//report,.xml
<books>
  <book>
     <title>title 1</title>
     <numPages>129</numPages>
   </book>
  <book>
     <title>title 2</title>
     <numPages>700</numPages>
   </book>
  <book>
     <title>title 3</title>
     <numPages>2122</numPages>
   </book>
</books>

0
Comment
Question by:jlbo_davinchi
1 Comment
 
LVL 12

Accepted Solution

by:
jkmyoung earned 500 total points
ID: 18890140
http://www.w3schools.com/xsl/func_document.asp
Use the function document to import the second document.

eg, if you applied the stylesheet to the links.xml,
you could have in the stylesheet somewhere:

<xsl:apply-templates select="document('report.xml')"/>
to get the data from the report xml.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
It’s a strangely common occurrence that when you send someone their login details for a system, they can’t get in. This article will help you understand why it happens, and what you can do about it.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now