[xsl] Dynamic attribute name in predicate

Subject: [xsl] Dynamic attribute name in predicate
From: "Dick Penny" <d_penny@xxxxxxx>
Date: Thu, 06 Aug 2009 16:07:39 -0700
As a newbie, I've had reasonable success with help from this group. Now I am
stretching my wings a bit and trying MK's "convenience lists" to drive my
transformation. I can't figure out how to also use an attribute name from
convenience list D1 as well as it value.
=========working snippet start
<xsl:variable name="allRows" select="/dsQueryResponse/Rows/Row"/>

<xsl:variable name="D1">
<GroupAssigned>CRA</GroupAssigned>
<GroupAssigned>HR</GroupAssigned>
<GroupAssigned>Legal</GroupAssigned>
</xsl:variable>

<xsl:template match="/">

<table class="newStyle1">

<xsl:for-each select="msxsl:node-set($D1)/GroupAssigned">
<tr>
<td><xsl:value-of select="." /></td>
<xsl:variable name="d1" select="."/>
<xsl:variable name="d1Rows" select="$allRows[@GroupAssigned=$d1]"/>
=========working snippet end
None of next three work, I thought they would. I guess I don't understand the
syntax as well as I thought.
<xsl:variable name="d1Rows" select="$allRows[@name()=$d1]"/>
<xsl:variable name="d1Rows" select="$allRows[@local-name()=$d1]"/>
<xsl:variable name="d1Rows" select="$allRows[@GroupAssigned=.]"/>

Dick Penny

Current Thread