[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: document() loops
David, The following is the code and the explanation of my problem the code.. main xml. <?xml version="1.0"?> <univ-xml-list> <univ-xml>univ1.xml</univ-xml> <univ-xml>univ2.xml</univ-xml> <univ-xml>univ3.xml</univ-xml> </univ-xml-list> Xsl.. <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xalan="http://xml.apache.org/xalan" xmlns:write-to-file="org.apache.xalan.xslt.extensions.Redirect" extension-element-prefixes="write-to-file xalan" version="1.0"> <xsl:key match="*" use="descendent" name="all-nodes"/> <xsl:template match="univ-xml-list"> <xsl:for-each select="document(univ-xml[1])"> <basic> <first> <xsl:for-each select="document(univ-xml[2])"> <xsl:copy-of select="*"/> </xsl:for-each> </first> <xsl:copy-of select="*"/> </basic> </xsl:for-each> </xsl:template> </xsl:stylesheet> univ1.xml.. ********************************** <?xml version="1.0"?> <university-records> <univ-ids> <univ id = "KSU"> <name>Kansas State University</name> <location>Kansas</location> </univ> <univ id = "FAU"> <name>Florida Atlantic University</name> <location>Florida</location> </univ> <univ id = "MSU"> <name> Mississipi State University</name> <location> Mississipi </location> </univ> <univ id = "OSU"> <name>Ohio State University</name> <location> Ohio </location> </univ> </univ-ids> <university-results> <university univ-id = "KSU">100%</university> <university univ-id = "MSU">90%</university> <university univ-id = "FAU">80%</university> </university-results> </university-records> ********************************** univ2.xml ********************************** <?xml version="1.0"?> <university-records> <univ-ids> <univ id = "OSU"> <name> Ohio State University</name> <location> Ohio </location> </univ> <univ id = "WSU"> <name> Wisconsin state University</name> <location> Wisconsin </location> </univ> <univ id = "RPI"> <name> Rensellar polytechnic Institute </name> <location> New Jersey </location> </univ> <univ id = "MSU"> <name> Mississipi State University</name> <location> Mississipi </location> </univ> </univ-ids> <university-results> <university univ-id = "OSU">70%</university> <university univ-id = "WSU">100%</university> <university univ-id = "RPI">100%</university> </university-results> </university-records> ********************************** univ3.xsl ********************************** <?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 id = "WSU"> <name>Wisconsin state University</name> <location> Wisconsin </location> </univ> <univ id = "BCM"> <name> Berklee College of Music</name> <location> Berklee </location> </univ> </univ-ids> <university-results> <university univ-id = "NU">70%</university> <university univ-id = "BU">60%</university> <university univ-id = "BCM">100%</university> </university-results> </university-records> ************************************** what i want is to read from the mainxml the locations of the xml files, and merge them into one xml in such a way that the it has the same structure as individual xmls and the elements gets inserted into corresponding parent elements.. example output file.. <?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 id = "WSU"> <name>Wisconsin state University</name> <location> Wisconsin </location> </univ> <univ id = "BCM"> <name> Berklee College of Music</name> <location> Berklee </location> </univ> <univ id = "KSU"> <name>Kansas State University</name> <location>Kansas</location> </univ> <univ id = "FAU"> <name>Florida Atlantic University</name> <location>Florida</location> </univ> <univ id = "OSU"> <name>Ohio State University</name> <location> Ohio </location> </univ> <univ id = "RPI"> <name> Rensellar polytechnic Institute </name> <location> New Jersey </location> </univ> <univ id = "MSU"> <name> Mississipi State University</name> <location> Mississipi </location> </univ> </univ-ids> <university-results> <university univ-id = "NU">70%</university> <university univ-id = "BU">60%</university> <university univ-id = "BCM">100%</university> <university univ-id = "OSU">70%</university> <university univ-id = "WSU">100%</university> <university univ-id = "RPI">100%</university> <university univ-id = "KSU">100%</university> <university univ-id = "MSU">90%</university> <university univ-id = "FAU">80%</university> </university-results> </university-records> I cant get this going. This may be a simple task.. any suggestions will be deeply appreciated From: David Carlisle <davidc@xxxxxxxxx> Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: document() loops Date: Thu, 12 Sep 2002 16:18:22 +0100 _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx 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
|