I have the following XML document:
<text xmlns:its="http://www.w3.org/2005/11/its" >
<its:rules version="2.0">
<its:termRule selector="//term" term="yes" termInfoPointer="id(@def)"/>
</its:rules>
<p>We may define <term def="TDPV">discoursal point of view</term>
as <gloss xml:id="TDPV">the relationship, expressed through discourse
structure, between the implied author or some other addresser,
and the fiction.</gloss>
</p>
</text>
termInfoPointeris an XPath expression that points to an element <gloss xml:id="TDPV">.
I use LINQ-to-XML to select it.
XElement term = ...;
object value = term.XPathEvaluate("id(@def)");
I get the following exception: System.NotSupportedException: This XPathNavigator does not support IDs.
I could not find a solution to this problem, so I tried replacing id()with other expressions:
//*[@xml:id='TDPV'] // works, but I need to use @def
//*[@xml:id=@def]
//*[@xml:id=@def/text()]
//*[@xml:id=self::node()/@def/text()]
but none of these works.
Is there a way to implement id()or replace it with another expression?
I would prefer a solution / workaround that does not involve replacing id()with another expression, because this expression can be something complicated, for example id(@def) | id(//*[@attr="(id(@abc()))))))"]).
source
share