[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

including external XML file and process whole new tree

Subject: including external XML file and process whole new tree
From: "Matt Adams" <mattad@xxxxxxxxx>
Date: Fri, 03 Dec 2004 18:58:21 +0100
external xml file
How can I insert an external xml file into a given first xml file
and start then processing the target xml as base for xpath expressions?
Seems difficult question but isn't. Assume the following sample:

first.xml:
<myelem>
  <subelem aaa="1" />
  <subelem aaa="2" />
  <otherfile name="second.xml" />
</myelem>

second.xml:
<parts>
 <subelem aaa="3" />
 <subelem aaa="4" />
</parts>

mysample.xslt:
....
<xsl:replaceotherfileby select="document(//otherfile/@name)" />
<!-- temporary tree in memory should be now:
<myelem>
  <subelem aaa="1" />
  <subelem aaa="2" />
  <parts>
    <subelem aaa="3" />
    <subelem aaa="4" />
  </parts>
</myelem>
-->
<xsl:for-each ... select="//subelem">
  <xsl:value-of select="./@aaa" />
</xsl:for-each>

output:
1
2
3
4

How do I code the function here called "replaceotherfileby"?

Second related question: Suppose in first.xml and second.xml
different prefixes are used for the same namespace.
Is your solution a pure textual replacement or are
the prefixes adjusted according to the refering common
namespace as well?

Thank you
Matt











--
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.