我尝试将 2 个相互排斥的条件 XPath 表达式与“|”结合使用 命令来评估适当的 XML 节点。我正在使用 InfoPath 2010。
当我使用下面的示例 XML 打开我的表单时,我被告知在我的“规则”中存在一个循环 - 即我的 XPath 表达式之一是无限期地在目标节点之间翻转。我不知道我做错了什么。
这是 XPath 表达式:
//my:SPIF_Info_Repeater[1 = count(following-sibling::my:SPIF_Info_Repeater)]//my:SPIF_Chargeable_Object_Number[text()] | //my:Chargeable_Object_Number[text() and not(//my:SPIF_Info_Repeater[1 = count(following-sibling::my:SPIF_Info_Repeater)]//my:SPIF_Chargeable_Object_Number[text()])]
我相信在表单<my:SPIF_Chargeable_Object_Number>
中评估表达式时,InfoPath 将 用作“当前”节点值。这是该节点的默认值。
这是我的目标 XML。抱歉,它是如此嵌套;我已经删除了所有可能敏感的内容,但保留了所涉及的节点结构完好无损。
<?xml version="1.0"?><?mso-infoPathSolution PIVersion="1.0.0.0" href="" name="urn:schemas-microsoft-com:office:infopath:PPIF-Forms:-myXSD-2011-05-05T19-56-08" productVersion="14.0.0" solutionVersion="1.0.0.1090" ?><?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.2"?>
<?mso-infoPath-file-attachment-present?>
<my:myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" xmlns:pc="http://schemas.microsoft.com/office/infopath/2007/PartnerControls" xmlns:tns="http://microsoft.com/webservices/SharePointPortalServer/UserProfileService" xmlns:s1="http://microsoft.com/wsdl/types/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ma="http://schemas.microsoft.com/office/2009/metadata/properties/metaAttributes" xmlns:d="http://schemas.microsoft.com/office/infopath/2009/WSSList/dataFields" xmlns:q="http://schemas.microsoft.com/office/infopath/2009/WSSList/queryFields" xmlns:dms="http://schemas.microsoft.com/office/2009/documentManagement/types" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2011-05-05T19:56:08" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xml:lang="en-us">
<my:MasterSection>
<my:ActualProjectHider/>
<my:SPIF_Hider>
<my:SPIF_Info_Repeater_Group>
<my:SPIF_Info_Repeater>
<my:SPIF_Chargeable_Line_Items_Group>
<my:SPIF_Chargeable_Line_Items>
<my:Amount_Hider/>
</my:SPIF_Chargeable_Line_Items>
<my:SPIF_Chargeable_Line_Items>
<my:Amount_Hider/>
</my:SPIF_Chargeable_Line_Items>
<my:SPIF_Chargeable_Line_Items>
<my:Amount_Hider/>
</my:SPIF_Chargeable_Line_Items>
<my:SPIF_Chargeable_Line_Items>
<my:Amount_Hider/>
</my:SPIF_Chargeable_Line_Items>
<my:SPIF_Chargeable_Line_Items>
<my:Amount_Hider/>
</my:SPIF_Chargeable_Line_Items>
<my:SPIF_Chargeable_Line_Items>
<my:Amount_Hider/>
</my:SPIF_Chargeable_Line_Items>
<my:SPIF_Chargeable_Line_Items>
<my:Amount_Hider/>
</my:SPIF_Chargeable_Line_Items>
<my:SPIF_Chargeable_Line_Items>
<my:Amount_Hider/>
</my:SPIF_Chargeable_Line_Items>
</my:SPIF_Chargeable_Line_Items_Group>
<my:SPIF_Data>
<my:SPIF_Chargeable_Object_Number>APPLES</my:SPIF_Chargeable_Object_Number>
</my:SPIF_Data>
</my:SPIF_Info_Repeater>
<my:SPIF_Info_Repeater>
<my:SPIF_Chargeable_Line_Items_Group>
<my:SPIF_Chargeable_Line_Items>
<my:Amount_Hider/>
</my:SPIF_Chargeable_Line_Items>
<my:SPIF_Chargeable_Line_Items>
<my:Amount_Hider/>
</my:SPIF_Chargeable_Line_Items>
<my:SPIF_Chargeable_Line_Items>
<my:Amount_Hider/>
</my:SPIF_Chargeable_Line_Items>
<my:SPIF_Chargeable_Line_Items>
<my:Amount_Hider/>
</my:SPIF_Chargeable_Line_Items>
</my:SPIF_Chargeable_Line_Items_Group>
<my:SPIF_Data>
<my:SPIF_Chargeable_Object_Number>BANANAS</my:SPIF_Chargeable_Object_Number>
</my:SPIF_Data>
</my:SPIF_Info_Repeater>
</my:SPIF_Info_Repeater_Group>
</my:SPIF_Hider>
<my:ProjectTypeInfo/>
<my:AdminPass>
<my:ViewSwitcher/>
<my:AdminPassText></my:AdminPassText>
</my:AdminPass>
<my:SPIFInitErrorHider/>
</my:MasterSection>
</my:myFields>
我花了相当长的时间来隔离这个问题。我的 XPath 表达式中一定有一些东西会导致节点之间的迭代。