c# - Computing a value from an XPathNavigator -
i trying write function xsl transform.
basically within function have system.xml.xpath.xpathnodeiterator
, want value of xpath when applied each of nodes within iterator.
in instance xpath concat(name(.) , "_", string(.))
anything.
this throwing xpathexception: "expression must evaluate node-set." kind of makes sense
i suspect i'm going told not valid xpath other xml/xsl related functionality however, consider in xsl can this:
<xsl:value-of select="concat(name(.) , "_", string(.))"/>
and i'm after - within function.
i'm using c# vb answers acceptable.
system.xml.xpath.xpathnodeiterator nodes = whatever; string keyselector="concat(name(.), '_', string(.))"; while (nodes.movenext()) { system.xml.xpath.xpathnavigator xpnvalue = nodes.current.selectsinglenode(keyselector); }
you need use evaluate
method , not selectsinglenode
. , result of xpath not xpathnavigator
, xpath string
respectively .net system.string
or c# string
.
Comments
Post a Comment