Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 12th, 2008, 11:31 AM
Authorized User
 
Join Date: Mar 2008
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.

 
Old March 12th, 2008, 11:38 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
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
 
Old March 12th, 2008, 11:42 AM
Authorized User
 
Join Date: Mar 2008
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Much appreciated :)






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





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