[xsl] transform childnodes from second XML file based on node name matc h

Subject: [xsl] transform childnodes from second XML file based on node name matc h
From: Kamal Kumar <kamalk@xxxxxxxxxxxx>
Date: Mon, 29 Jan 2001 18:43:09 +0400
Hello,

I have a requirement to transform a particular XML file ( SETS.XML) and for
certain nodes (set*)  use data from a second file ( CHANNELS.XML)  for the
transformation. I use document() function to load the second file and
retrieve the required nodes. For a typical case ( month of Jan) the
transformation would look like..

<xsl:template name="channels">

	<TR><TD><xsl:value-of select="name"></TD>><TD><xsl:value-of
select="set1"></TD>><TD><xsl:value-of select="set3"></TD><TR>

</xsl:template>

My problem is that the sets vary with month and I need the template above to
change dynamically. I tried passing the node names using with-param but it
returns the value of the node name when it processes the xsl:value-of.  

Is there something I can do within xsl to handle this. The xml files are
given below. Currently I do a two step transformation using asp scripts
replacing the text within the above template as the sets change.


File SETS.XML has the structure given below.
......
<lostsOfinfo></lotsOfinfo>
<month>Jan
   <sets>
	<set1>1<set1>
	<set3>3</set3>
   </sets>
</month>
<month>Feb
  <sets>
	<set1>1<set1>
	<set5>4</set5>
   </sets>
</month>
.....

File CHANNELS.XML is as below
<CHANNELS>
.....
   <CHANNEL>
	<NAME>Movies</NAME>
	<SET1>BraveHeart</SET1>
	<SET2>aaaa</SET2>
	<SET3>bbbbb</SET3>
	<SET4>ccccc</SET4>
   </CHANNEL>
   <CHANNEL>
	<NAME>Sports</NAME>
	<SET1>dddd</SET1>
	<SET2>aaaa</SET2>
	<SET3>bbbbb</SET3>
	<SET4>ccccc</SET4>
   </CHANNEL>
....
</CHANNELS>

thanks
Kamal Kumar

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread