XPath表达式导致自引用(循环)

时间:2013-10-24 13:26:40

标签: xml loops xpath conditional-statements infopath2010

我尝试将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()])]

我相信在表单中计算表达式时,InfoPath使用<my:SPIF_Chargeable_Object_Number>作为“当前”节点值。它是该节点的默认值。

这是我的目标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表达式中导致节点之间迭代的东西。

0 个答案:

没有答案