[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Multiple XML files into one XSLT template.

Posted on 2001-06-21
4
Medium Priority
?
386 Views
Last Modified: 2008-03-03
Is it possible to input 2 or more XML documents into one XSLT template.

I have to XML file and i would like to create one XML file as the result.

Is this possible ?  I am using Xanlan.
0
Comment
Question by:jefftk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
djokov earned 900 total points
ID: 6218091
Yes, it is possible:
If you want to input XML file into another XML, use:
<!DOCTYPE document_element [
<!ENTITY second SYSTEM "secondfile.xml">
<!ENTITY other SYSTEM "otherfile.xml">
]>
after <?xml version="1.0"?> which is the top of any XML file and then, anywhere in the file after the root you could use:
&second; or
&other;
in order to include XML file 'secondfile' in the current XML file. 'document_elemnt' is the name of the root element of your xml file.

If you want to include one stylesheet into another, you should use:
<xsl:include href="templateHeader.xsl"/>

In your case you should include one of the XML files into another and then to execute transformation with Xalan and a stylesheet. So your main xml file that you should pass to Xalan as a input xml file will look as:

<?xml version="1.0"?>
<!DOCTYPE blabla [
<!ENTITY second SYSTEM "secondfile.xml">
]>

<blabla>
<something>.....
.....
</something>
&second;
</blabla>

Hope it will help.

Regards,
Djokov
0
 

Author Comment

by:jefftk
ID: 6218549
Hi Djokov,

Here is my issue, I have a servlet that reads in a character stream of data from a client.  This character stream is an XML message.  I will open the stream and read the data and act on the message.

When i am done processing this message i need to send a response XML message.  I would like to use XSLT to create the response XML.  
My inputs to the XSLT processor will be the input XML message and a small XML message i created when i processed the input XML.

These two inputs will reside in memory and not on disk.
I believe i can do this if I transform the XML twice.  First using the input XML and then a second time using the new XML.  However, this would require two stylesheets and two transforms.

Can this be done in one pass ?
Any examples would be appreciated.
0
 

Author Comment

by:jefftk
ID: 6232588
Hi Djokov,

Do you have any comments for my last comment ?
0
 
LVL 6

Expert Comment

by:Wayne Bradney
ID: 6233480
jefftk,

You could include your small XML file into your larger one by just appending the documentElement of the smaller XML document under the documentElement of the larger one. Then you have all of the XML in a single document and a single stylesheet can transform it.

Before appending, you'll need to importNode first. By default, nodes aren't allowed to cross DOM boundaries.

Regards,
WMB
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

650 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