I am trying to do the following in an xsl file:

ANSWER[@id = concat(local-name(),'_STYLE')]/@valueSrc

The xml I am transforming is as follows:

<DECK desc="Deck" id="DECK1">
	<ANSWER id="DECK_STYLE" valueSrc="USER" />
</DECK>

The result of this gives me an empty string. However if I make a variable and use it like this:

<xsl:variable name="prefix" select="local-name()" />
ANSWER[@id = concat($prefix,'_STYLE')]/@valueSrc

It works just fine. I figured maybe its because you can't call a function inside of a function (which I know can't be true) but for curiousity's sake I tried the following and it worked fine as well:

ANSWER[@id = concat(concat('DE','CK'),'_STYLE')]/@valueSrc

Does anyone have any ideas on why:

ANSWER[@id = concat(local-name(),'_STYLE')]/@valueSrc

doesn't return a value for me?

use this X-Path :-

//DECK/ANSWER[@id[contains(.,'_STYLE')]]/@valueSrc

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.