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

RE: nested for-each on disjoint node sets & variable

Subject: RE: nested for-each on disjoint node sets & variable scope
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 20 Jul 2009 23:35:37 +0100
RE:  nested for-each on disjoint node sets & variable
The variable reference $oneRow looks OK to me.

I'm afraid it's not clear to me what you're trying to do or what problems
you are having. You don't show your input, you don't say what output you
want, you only show part of your code, and you don't say how it fails.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 
 

> -----Original Message-----
> From: Dick Penny [mailto:d_penny@xxxxxxx] 
> Sent: 20 July 2009 23:19
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  nested for-each on disjoint node sets & variable scope
> 
> I am trying sub-set my input rows and output the count of 
> rows per sub-set into a table such that the sub-sets are 
> mutually exclusive and collectively exhaustive. I use temp 
> node-sets to drive the sub-set production as per below.
> 
> I am reasonably far along for a novice but realize I don't 
> fully understand MK's table of variable scope. I believe in 
> code below that $oneRow has gone out of scope in the 2nd 
> for-each but I don't know what to do about it. Since I will 
> be adding a 3rd and 4th dimension of sub-setting, I'd like to 
> get the structure correct. I know the td's and tr's are 
> messed up, am not worried.
> 
> <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row"/>
> 
> <xsl:variable name="D1">
> 	<group>CRA</group>
> 	<group>HR</group>
> 	<group>Legal</group>
> </xsl:variable>
> 
> <xsl:variable name="D2">
> 	<src>Other</src>
> 	<src>EC_MailBox</src>
> 	<src>AlertLine</src>
> </xsl:variable>
> 
> <xsl:template match="/">
> 
> <table>
>     <tr><th>Col 1</th><th>Col 2</th>
>     </tr>
>     
>     <tr>
> <xsl:for-each select="msxsl:node-set($D1)/group">
> 	<xsl:variable name="d1" select="."/>
> 	<xsl:variable name="oneRow" select="$Rows[@GroupAssigned=$d1]"/>
> 	<td><xsl:value-of select="." /></td>
> 		
> 	<xsl:for-each select="msxsl:node-set($D2)/src">	
> 		<xsl:variable name="d2" select="."/>	
> 		<xsl:call-template name="oneCell">
> OUT-OF-SCOPE?		<xsl:with-param name="cnt"
> select="count($oneRow[@Source=$d2])"/>
> 		</xsl:call-template>	
> 	</xsl:for-each>	
> 		
> 	<td><xsl:value-of select="count($oneRow)" /></td> 
> </xsl:for-each>
> 
> Dick Penny

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.