xml - How to access an attribute with a computed name -


i want read value of attribute using variable compute name:

<xsl:variable name="topman">     <xsl:for-each select="//all_resources/*/*/*">         <xsl:if test="contains(@name,'chan' )">             <xsl:variable name="element_name" select="name(..)"/>             <xsl:variable name="fchansub" select="(//all_resources/*/*[$element_name = name()]/@usedele)"/>             <xsl:value-of select="(//all_resources/*[(substring-before($element_name, '_')) = name()]/@[(concat('neibr_', $fchansub)) = name()])"/>              </xsl:if>     </xsl:for-each> </xsl:variable> 

there problem line 6. reading value correct. basically, having structure neibr_hm1, neibr_nr, etc.. want read value in neibr_(hm1 or nr).

without seeing input or expected output can't 100% sure, think you're pretty close: change

@[(concat('neibr_', $fchansub)) = name()] 

to

@*[(concat('neibr_', $fchansub)) = name()] 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -