RE: [xsl] Dynamic attribute name in predicate

Subject: RE: [xsl] Dynamic attribute name in predicate
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 7 Aug 2009 00:15:21 +0100
You've shown some code that doesn't work, but you haven't shown your input
or your desired output, so it's hard to see what you're trying to achieve.


Michael Kay 

> -----Original Message-----
> From: Dick Penny [mailto:d_penny@xxxxxxx] 
> Sent: 07 August 2009 00:08
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Dynamic attribute name in predicate
> 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