function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mtmattmtmatt 

XSL transform of SOAP Query Result

I'm having some trouble applying an XSL transformation to data returned from a SOAP Query to Sforce. I've included the XSL and the SOAP message below along with a chunk of ASP code that attempts the transform. 

Any ideas why this might be broken?

----------begin cases.xsl------------
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
 <xsl:for-each select="value/valueMap">
  <tr>
  <td><xsl:value-of select="caseNumber" /></td>
  <td><a href="#"><xsl:value-of select="subject" /></a></td>
  <td><xsl:value-of select="id" /></td>
  <td><xsl:value-of select="status" /></td>  
  </tr>
 </xsl:for-each>
</xsl:template>
</xsl:stylesheet>

----------begin soap message received from Sforce--------------
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="salesforce" xmlns:types="salesforce/encodedTypes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
<soap:Header/>
<soap:Body>
<sfdc:queryResponse xmlns:sfdc="sfconnector:SalesforceConnector">
<return>
<value xsi:type="tns:array">
<valueMap xsi:type="tns:map">
   <status xsi:type="xsd:string">Closed</status>
   <subject xsi:type="xsd:string">Starting generator after electrical failure</subject>
   <caseNumber xsi:type="xsd:string">00001000</caseNumber>
   <id xsi:type="xsd:string">500300000007s4r</id>
</valueMap>
<valueMap xsi:type="tns:map">
   <status xsi:type="xsd:string">Closed</status>
   <subject xsi:type="xsd:string">Shutting down of generator</subject>
   <caseNumber xsi:type="xsd:string">00001001</caseNumber>
   <id xsi:type="xsd:string">500300000007s4s</id>
</valueMap>
</value>
</return>
</sfdc:queryResponse>
</soap:Body>
</soap:Envelope>

---------------Begin ASP Snippet------------------
  strXSLFile = "cases.xsl"
  set rootNode = xmlObj.documentElement.selectSingleNode("soap:Body/sfdc:queryResponse/return/value") 
  strRows = transformXMLwithXSL(rootNode, strXSLFile)  'this function applies the XSL to the XML

bobyrnebobyrne

Try changing select attribute in the xsl:for-each to "//value/valueMap" or "//return/value/valueMap".

There is no value element in the XML root, so you must either use the '//' descendent-or-self notation or a full path.

Brian.