Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Apply a function to a result

Status
Not open for further replies.

Wiszh

Programmer
Aug 3, 2000
134
US
I am trying to select a series of attributes and apply a function to them:
For example
//row/@role
I want to apply the substring function to the role attribute. If I add it to the entire xpath then I only get one result
substring(//row/@role, '3')

If I apply the function to the attribute only I get an error:
//row/[substring(@role, '3')]

Any ideas???
 
Code:
<xsl:for-each select="//row">
  <xsl:value-of select="substring(@role, 3)"/>
</xsl:for-each>
Avoid using //, it will search every node. Where possible specify the full path.

Jon

"I don't regret this, but I both rue and lament it.
 
Thanks, for your reply.

I realize that it can be performed as a two step process, but is there any way to do this in one step?
(I am trying to use c# XmlNode.selectNodes(xpath here) for this.

Thanks again

Wiszh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top