//G1Export/compare(AgencyGroup//OrgId, BranchGroup//OrgId)
结果 = 0
已编辑:xslt 1 中有 2 个错误。对于 brnchOrgId,您使用的是 AgencyGroup 而不是 BranchGroup 2。对于 compare(),您应该有 =0 而不是 ='0'
更正了xslt:
<xsl:template match="/">
<xsl:element name="PICRESPONSE" namespace="fieldpoint.com/namespaces">
<xsl:for-each select="//G1Export/AgencyGroup">
<xsl:if test="count(.) > 0">
<!--org_id variable-->
<xsl:variable name="orgId" select="string(/G1Export/AgencyGroup/Agency/OrgId)"/>
<xsl:element name="EXPORTRESPONSE" namespace="fieldpoint.com/namespaces">; <xsl:for-each select="//G1Export/BranchGroup">
<xsl:if test="count(.) > 0">
<xsl:variable name="brnchOrgId" select="string(/G1Export/BranchGroup/BranchCode/OrgId)"/>
<!--Put the Branch information inside the current agency node only if branch belong to current Agency-->
<xsl:if test="compare($brnchOrgId,$orgId)=0">asda
<xsl:value-of select="'orgid is same as branchogid'"/>
</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:element>
</xsl:if>
</xsl:for-each>
</xsl:element>
</xsl:template>
输出:
<?xml version="1.0" encoding="UTF-8"?>
<PICRESPONSE xmlns="fieldpoint.com/namespaces">
<EXPORTRESPONSE>; orgid is same as branchogid</EXPORTRESPONSE>
</PICRESPONSE>
希望这可以帮助。