感谢您的解决方案。
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns="urn:partner.soap.sforce.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<LimitInfoHeader>
<limitInfo>
<current>18029</current>
<limit>5000000</limit>
<type>API REQUESTS</type>
</limitInfo>
</LimitInfoHeader>
</soapenv:Header>
<soapenv:Body>
<upsertResponse>
<result>
<created>false</created>
<id xsi:nil="true"/>
<success>false</success>
</result>
<result>
<created>false</created>
<id xsi:nil="true"/>
<success>false</success>
</result>
<result>
<created>false</created>
<id xsi:nil="true"/>
<success>false</success>
</result>
</upsertResponse>
</soapenv:Body>
</soapenv:Envelope>
对于上面的xml作为xslt的输入,输出低于一个
<?xml version="1.0" encoding="utf-8"?><soql>select (select Id from contacts where AccountId in (SELECT AccountId from Opportunity where id in ())), (select Id from opportunities where id in()) from account where id in (SELECT AccountId from Opportunity where id in())</soql>
如果给定输入xml中的所有成功标记值都为false,则不应生成<soql>
标记。我的意思是输出应该是空的
最终我需要的是有效的SOQL,以便我可以查询销售人员,对于上面给出的xml输入,生成的输出不是有效的SOQL。从此以后我无法查询销售人员。
所以需要在xslt中进行更改,需要你的帮助
由于
答案 0 :(得分:0)
为什么你不能简单地做到:
XSLT 1.0
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ns="urn:partner.soap.sforce.com"
exclude-result-prefixes="ns">
<xsl:variable name="ids">
<xsl:for-each select="//ns:result[ns:success='true']">
<xsl:text>'</xsl:text>
<xsl:value-of select="ns:id" />
<xsl:text>'</xsl:text>
<xsl:if test="position()!=last()">
<xsl:text>,</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:template match="/">
<soql>
<xsl:text>select (select Id from contacts where AccountId in (SELECT AccountId from Opportunity where id in (</xsl:text>
<xsl:value-of select="$ids"/>
<xsl:text>))), (select Id from opportunities where id in(</xsl:text>
<xsl:value-of select="$ids"/>
<xsl:text>)) from account where id in (SELECT AccountId from Opportunity where id in(</xsl:text>
<xsl:value-of select="$ids"/>
<xsl:text>))</xsl:text>
</soql>
</xsl:template>
</xsl:stylesheet>