xsl-list
[Top] [All Lists]

[xsl] nested for-each on disjoint node sets & variable scope

2009-07-20 18:19:34
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[(_at_)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[(_at_)Source=$d2])"/>
                </xsl:call-template>    
        </xsl:for-each> 
                
        <td><xsl:value-of select="count($oneRow)" /></td>
</xsl:for-each>

Dick Penny



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>