Re: document() loops
<!-- all the below xml files( univ1.xml.. etc are in the same directory as mainxml.xml
and the xsl should now go through each of the univ xmls and merge them.
What I thot of doing was first go through one of the xmls( the first one for example ) and construct the elements.
<xsl:for-each select="document(/univ-xml-list/univ-xml)"> <xsl:variable name = "element-name" select="name(.)"/> <xsl:element name="$element-name">
now the next thing what i want to do is ..
run a for-each against the mainxml.xml and plug in the element data into the above created element "where" the element name equals the name of the element from the first for-loop
<xsl:variable name = "element-name" select="name(.)"/>
<xsl:copy-of select="*[name(.) = $element-name]"/>
my intention above was to fill in the data elements from all the xml files specified in the mainxml.xml into the element created using the first xml( all xmls will have same structure)
But this does not work.. one of the univ xmls is as follows <?xml version="1.0"?> <university-records> <univ-ids> <univ id = "NSU"> <name> Newyork State University</name> <location> Newyork </location> </univ> <univ id = "BU"> <name> Belmont University</name> <location> Belmont </location> </univ> </univ-ids> <university-results> <university univ-id = "NSU">70%</university> <university univ-id = "BU">60%</university> </university-results> </university-records>
What i noticed was.. When the for-each is processing one document(),
it is not able to process any other document.. and also fails to recognize the elements from the mainxml.
I do not know if there is any other way of doing this? Thanks
From: David Carlisle <davidc@xxxxxxxxx> Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: document() loops Date: Thu, 12 Sep 2002 17:41:00 +0100
Join the world?s largest e-mail service with MSN Hotmail. http://www.hotmail.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format