Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 12th, 2008, 11:31 AM
Authorized User
 
Join Date: Mar 2008
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Loading XML files in XSLT

Is it possible to load an external XML file into an XSLT file and process it using ANOTHER XSLT file?

Example...

XML_file1.xml
<root>
 <list src="crap.xml" />
</root>

crap.xml
<list>
 <li>asdfasdf</li>
 <li>asdfasdf</li>
</list>

XSLT_file1.xsl
<xsl:template match="/">
 <table>
  <tbody>
   HERE I WANT TO LOAD crap.xml BASED ON list/@src and process it with this or another XSL file...
  </tbody>
 </table>
</xsl:template>



I was hoping there was a way to do this with XPath and an <xsl:variable> but I didn't see anything.

is this possible using any current methods (including exslt or anything like that?)

I am looking for a non-Microsoft specific implementation, but if it is possible with MS I would like to see that as well.

Thanks for any help.

PS: I am doing this for the next gen browers... so firefox 3 and IE7-8 would be my target platform.

Reply With Quote
  #2 (permalink)  
Old March 12th, 2008, 11:38 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You can load and process the file using

<xsl:apply-templates select="document('crap.xml')" mode="crap"/>

and then include another stylesheet module containing mode="crap" template rules using <xsl:include href="crap.xsl"/>. You don't have to process different documents using different modes or different stylesheet modules, but it can avoid confusion.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote
  #3 (permalink)  
Old March 12th, 2008, 11:42 AM
Authorized User
 
Join Date: Mar 2008
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Much appreciated :)

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Loading Xml Files in session causes problem umair.hasan ASP.NET 1.0 and 1.1 Professional 1 February 26th, 2008 04:02 AM
xslt differencing between two xml files dhollis XSLT 5 August 4th, 2006 08:49 AM
XSLT between two XML files NEO1976 XSLT 15 July 24th, 2006 08:52 AM
Compare two xml files using xslt sudha XSLT 0 March 10th, 2006 01:04 AM
Merge XML files into a xml file using xslt lxu XML 4 November 6th, 2003 06:01 PM



All times are GMT -4. The time now is 07:05 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.