This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

is it possible to access the previous context()


Hi all. 
Is it possible to access the previous context in nested <xsl:for-each>
loops.   

for example if my xml file is:

<root>
	<FilterTypes>
		<FilterType type="red"/>
		<FilterType type="green"/>
		<FilterType type="orange"/>
		<FilterType type="blue"/>	
	</FilterTypes>
	<Filters>
		<Filter>
			<Name>Not Shiny</Name>
			<Value>blah</Value>
			<FitlerType type="red" value="34"/>
			<FitlerType type="blue" value="87"/>
		</Filter>
		<Filter>
			<Name>Shiny</Name>
			<Value>other</Value>
			<FitlerType type="green" value="12"/>
			<FitlerType type="orange" value="13"/>
			<FitlerType type="blue" value="15"/>
		</Filter>
	</Filters>
</root>

I am trying to do the following:

<table>
<xsl:for-each select="/root/FilterTypes/FilterType">
  <tr>
   <xsl:for-each select ="/root/Data/Filters">
	<xsl:for-each select="Filter">
		<td>here I want to display the @value attribute for the
FilterType element of the current Filter where the @type attribute is equal
to the @type attribute of the current /root/FilterTypes/FilterType in the
context of the outermost for loop. ugh.  even I get confused by this
sentence but it's right, that's what I am trying to do. 
		</td>
	</xsl:for-each>
   </xsl:for-each>
  </tr>
</xsl:for-each>
</table>

the output I am looking for is the following:

		Not Shiny		Shiny
red		  34			Nan
green		NaN			12
orange		NaN			13
blue		 87			15

I am not sure if this is possible the way the xml file is structured. 
Thanks in advance any help is really appreciated.  

Vladimir.  


--------------------------------------------------------------------------------------
For more information about Barclays Capital, please
visit our web site at http://www.barcap.com.


Internet communications are not secure and therefore the Barclays Group
does not accept legal responsibility for the contents of this message.
Any views or opinions presented are solely those of the author and do 
not necessarily represent those of the Barclays Group unless otherwise 
specifically stated.

--------------------------------------------------------------------------------------

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]