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

Assigning multiple xml's file names into variable name

Subject: Assigning multiple xml's file names into variable name using for-each possible?
From: Karl <call14@xxxxxxxxx>
Date: Tue, 18 Jul 2006 10:24:25 +0100 (BST)
multiple xml file parser
I have a scenario where I have loads of xml which are all similar in
structure, but variy in content. I want to render all this xml's
using the same xsl file to get a html output for each xml file using
saxon parser.

So, what I was trying to do is to make a seperate xml file listing
all the xml file to be processed. e.g: xmlFileList.xml 

	<ContentGroup name="Arts">
		<ContentFile>S207.xml</ContentFile>
		<ContentFile>S103_2.xml</ContentFile>
		<ContentFile>DD03.xml</ContentFile>
		.... etc etc
	</ContentGroup>

the individual xml's e.g: S207.xml will look like 

<Item xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<Unit>
		<UnitID>Chapter 1</UnitID>
		<UnitTitle>Motion along a line</UnitTitle>
		<Session id="SES001">
			<Section id="SEC001">
				.....


And in the xsl file, trying to loop thro to get each file name and
process it like:

<xsl:template match="/"> <!-- of xmlFileList.xml -->
	<xsl:for-each select="//ContentFile">
		<xsl:variable name="fileName" select="node()"/>
		<xsl:variable name="currentFile" select="document('{$fileName}')"/>

		<!--?? VALID?? TRYING TO ACHIEVE  select="document('s207.XML') AND
SO ON -->
		<xsl:variable name="CourseId" select="substring-before($fileName,
'.xml')"/>

		<xsl:for-each select="$currentFile//Unit/Session/Section"> <!--
THIS SHOWS ERR -->
		<xsl:variable name="filename"
select="concat($CourseId,'_',@id,'.html')"/>
		<xsl:result-document href="{$filename}" format="html">
			<xsl:call-template name="Main">
			   ...
			</xsl:call-template>
		</xsl:result-document>
	</xsl:for-each>


I read somewhere I cannot load more than 1 xml doc using
document(''). Is that the reason for my err? Would be great if
someone explains me the mistake and how i con fix it. If no fix, then
alternate method to get the result which i want.

Thanks
karl



		
___________________________________________________________ 
Try the all-new Yahoo! Mail. "The New Version is radically easier to use"  The Wall Street Journal 
http://uk.docs.yahoo.com/nowyoucan.html

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.