私は、すべての空の要素を見つけて、最後の直後にテキストを返すXPath式を考案しました。XPath normalize-space()はステップ関数として機能しませんか?
私はこのXPathをOXYGENでテストし、探しているものを正確に返します。私がまだわからない理由のために、私はVisual Studio(C#)でそうすることができません。
XPath式:酸素中
<?xml version="1.0" encoding="UTF-8"?>
<topic id="topic_50038EEEBC214A0EBF0660DCFFCF69C6">
<title> Postulated Piping Failures in Fluid Systems Outside of
Containment</title>
<prolog>
<author/>
</prolog>
<body>
<p>
<b>Definitions</b>
</p>
<p>
<u>Leakage</u>
</p>
<p>
<xref
href="t1.3.2.2_System Quality Group Classifications.dita#topic_AE87340A0F424D07B0E301E243CCB7B2"
format="dita" scope="local"><?xm-replace_text System Quality Group Classifications?></xref>
TEXT
</p>
<p>
<u>
</u>TEXT
<xref></xref>5.2
</p>
</body>
</topic>
、XPathのバーを使用して、その結果:ここ
//xref[not(@href)]/normalize-space(substring(following-sibling::text()[1], 1, 20))
はDITA(XML)ファイルのXPath検索の一例です私が検索したいのとまったく同じ "5.2"です。ここで
は、ノードを取得するためのC#です:
String xPathFindXREF = "//xref[not(@href)]/normalize-space(substring(following-sibling::text()[1], 1, 20))";
XmlNodeList xmlNodeList = currFile.SelectNodes(xPathFindXREF);
は、C#でnormalize-space()
のようなXPath関数を使用することが可能ですか?
[normalize-space()関数を動作させるにはどうすればいいですか?](https://stackoverflow.com/questions/1829176/how-to-get-the-normalize-space-xpath-function -to-work) –