次のXPath式を変更して、前の「like」要素の数を返す方法はありますか?特定のブランチ内の同様のノードの数の相対カウントが必要です(ブランチだと思います...)これはMSInfoPathで使用されています。
count(../preceding-sibling::*) + 1
私のサンプルXMLの構造は、これが意図したとおりに動作するのを妨げていると思います。XMLのすべての「カウント」値の数値が1であることに気付くでしょう。DateRepeaterCounter
値は新しいMasterRepeater
ノードでリセットされ、ノードのMasterRepeaterCounter
総数を反映する必要がありますMasterRepeater
。
XPathで学習曲線を克服することはまだできていません。
<?xml version="1.0" encoding="UTF-8"?><?mso-infoPathSolution solutionVersion="1.0.0.25" productVersion="14.0.0" PIVersion="1.0.0.0" href="file:///C:\Documents%20and%20Settings\Chris\Local%20Settings\Application%20Data\Microsoft\InfoPath\Designer3\e1d38b31bb224d94\manifest.xsf" ?><?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.2"?>
<my:myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2012-09-07T14:19:10" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xml:lang="en-us">
<my:PrimarySection>
<my:MasterRepeater>
<my:MasterRepeaterCounter>1</my:MasterRepeaterCounter>
<my:DateSection>
<my:DateRepeater>
<my:Date>2012-09-12</my:Date>
<my:DateRepeaterCounter>1</my:DateRepeaterCounter>
</my:DateRepeater>
<my:DateRepeater>
<my:Date>2012-09-13</my:Date>
<my:DateRepeaterCounter>1</my:DateRepeaterCounter>
</my:DateRepeater>
<my:DateRepeater>
<my:Date>2012-09-14</my:Date>
<my:DateRepeaterCounter>1</my:DateRepeaterCounter>
</my:DateRepeater>
</my:DateSection>
</my:MasterRepeater>
<my:MasterRepeater>
<my:MasterRepeaterCounter>1</my:MasterRepeaterCounter>
<my:DateSection>
<my:DateRepeater>
<my:Date>2012-09-15</my:Date>
<my:DateRepeaterCounter>1</my:DateRepeaterCounter>
</my:DateRepeater>
<my:DateRepeater>
<my:Date>2012-09-16</my:Date>
<my:DateRepeaterCounter>1</my:DateRepeaterCounter>
</my:DateRepeater><my:DateRepeater>
<my:Date>2012-09-17</my:Date>
<my:DateRepeaterCounter>1</my:DateRepeaterCounter>
</my:DateRepeater>
</my:DateSection>
</my:MasterRepeater>
</my:PrimarySection>
</my:myFields>
編集と回答
InfoPathは、どういうわけか式を台無しにしていました...あるフィールドに式を入力し、それを別のフィールドにコピーした後、正しく機能しなくなりました。上記の形式でepxressionを再入力すると、問題が解決しました。StackOverflowで許可されたら、自己回答します。ありがとう!