Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

How to use 'and' operand in xsl for-each select AllRows

$
0
0

 Hi,

I would like to cascade the filter on columns to trim down its values. However I cannot seem to get the right value. I think the 'and' operand is wrong:

Column 1: Display All

<xsl:for-each select="$AllRows[generate-id(.) = generate-id(key('keyOrg2', @OrgLevel2)[1])]">

Column 2: use 'and' for column 1 and column 2

<xsl:for-each select="$AllRows[generate-id(.) = generate-id(key('keyOrg3', @OrgLevel3)[1])and @OrgLevel2 = $OrgLevel2 ] ">

Column 3: use and for column 1 and column 2 and column 3

<xsl:for-each select="$AllRows[generate-id(.) = generate-id(key('keyApplication', @ApplicationEnvironment)[1])and @OrgLevel2 = $OrgLevel2 and @OrgLevel3 = $OrgLevel3]">
Here is the actual code:
<tr><td class="header">
					Org Level 1</td><td class="control" id="org-level-1-control"><xsl:for-each select="$AllRows[generate-id(.) = generate-id(key('keyOrg1', @OrgLevel1)[1])]"><xsl:variable name="thisNode" select="."></xsl:variable><xsl:value-of select="$thisNode/@OrgLevel1" disable-output-escaping="yes"></xsl:value-of><xsl:if test="position()!=last()"><xsl:text> | </xsl:text></xsl:if></xsl:for-each></td><td></td></tr><tr><td class="header">Org Level 2</td><td><select id="org-level-2" name="org-level-2"><option></option><xsl:for-each select="$AllRows[generate-id(.) = generate-id(key('keyOrg2', @OrgLevel2)[1])]"><xsl:sort select="@OrgLevel2" ></xsl:sort><xsl:variable name="thisNode" select="."></xsl:variable>							<xsl:if test="$thisNode/@OrgLevel2 != ''"><option><xsl:attribute name="value"><xsl:call-template name="url-encode"><xsl:with-param name="str" select="$thisNode/@OrgLevel2"></xsl:with-param></xsl:call-template></xsl:attribute><xsl:value-of select="$thisNode/@OrgLevel2" disable-output-escaping="yes"></xsl:value-of></option></xsl:if></xsl:for-each></select></td><!--<td class="msg org2">required</td>--></tr><tr><td class="header">Org Level 3</td><td><select id="org-level-3" name="org-level-3"><option></option><xsl:for-each select="$AllRows[generate-id(.) = generate-id(key('keyOrg3', @OrgLevel3)[1]) ] "><xsl:sort select="@OrgLevel3" ></xsl:sort><xsl:variable name="thisNode" select="."></xsl:variable><xsl:if test="$thisNode/@OrgLevel3 != ''"><option><xsl:attribute name="value"><xsl:call-template name="url-encode"><xsl:with-param name="str" select="$thisNode/@OrgLevel3"></xsl:with-param></xsl:call-template></xsl:attribute><xsl:value-of select="$thisNode/@OrgLevel3" disable-output-escaping="yes"></xsl:value-of></option></xsl:if></xsl:for-each></select></td><!--<td class="msg org3">required</td>--></tr>			<tr><td class="header">Application Environment</td><td><select id="application-environment" name="application-environment"><option></option><xsl:for-each select="$AllRows[generate-id(.) = generate-id(key('keyApplication', @ApplicationEnvironment)[1])and @OrgLevel2 = $OrgLevel2 and @OrgLevel3 = $OrgLevel3]"><xsl:sort select="@ApplicationEnvironment" ></xsl:sort><xsl:variable name="thisNode" select="."></xsl:variable><xsl:if test="$thisNode/@ApplicationEnvironment != ''"><option><xsl:value-of select="$thisNode/@ApplicationEnvironment" disable-output-escaping="yes"></xsl:value-of></option></xsl:if></xsl:for-each></select></td><td class="msg"></td></tr><tr><td class="header">Phase</td><td><select id="phase" name="phase"><option></option><xsl:for-each select="$AllRows[generate-id(.) = generate-id(key('keyPhase', @Phase)[1])and @OrgLevel2 = $OrgLevel2 and @OrgLevel3 = $OrgLevel3 and @ApplicationEnvironment = $Application]"><xsl:sort select="@Phase" data-type="number"></xsl:sort><xsl:variable name="thisNode" select="."></xsl:variable><xsl:if test="$thisNode/@Phase != ''"><option><xsl:value-of select="$thisNode/@Phase" disable-output-escaping="yes"></xsl:value-of></option></xsl:if></xsl:for-each></select></td><!--<td><a href="#" id="apply-filter">Filter</a></td>--></tr>

Your response is appreciated.

Thanks!


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>