I fail to understand how the XSLT processor processes my XSLT. Using the following XSLT...
PHP Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method='xml' />
<xsl:template match="/">
<Envelope>
<soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" >
<ns1:SessionHeader soapenv:mustUnderstand="0" xmlns:ns1="urn:enterprise.soap.sforce.com">
<ns2:sessionId xmlns:ns2="urn:enterprise.soap.sforce.com"><xsl:value-of select="//session/sessionid" /></ns2:sessionId>
</ns1:SessionHeader>
</soapenv:Header>
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<logout xmlns="urn:enterprise.soap.sforce.com" />
</soapenv:Body>
</Envelope>
</xsl:template>
</xsl:stylesheet>
... executed on this XML:
PHP Code:
<?xml version="1.0" encoding="UTF-8"?>
<partnersystemtype systypeid="0af004ea-f3a2-4f54-bf28-44407e2c19cc"
systypename="WS Salesforce PST" systypeversion="12">
<session>
<sessionid>1234</sessionid>
</session>
</partnersystemtype>
produces the following output:
PHP Code:
<?xml version="1.0" encoding="UTF-8"?>
<Envelope>
<soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<SessionHeader xmlns:ns1="urn:enterprise.soap.sforce.com"
soapenv:mustUnderstand="0">
<sessionId xmlns:ns2="urn:enterprise.soap.sforce.com">1234
</sessionId>
</SessionHeader>
</soapenv:Header>
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<logout xmlns="urn:enterprise.soap.sforce.com" />
</soapenv:Body>
</Envelope>
Ok, but I want to have those namespaces ns1 and ns2 placed where I have placed them in the XSLT (i.e. <ns2:sessionId ... and <ns1:SessionHeader ...). With the current output the target web service cannot find the sessionId node because it seems to be in the wrong namespace (I could be in error about this, though). I probably failed to completely grasp the concept of namespaces. I would be very glad if you can give a short explanation why ns1: and ns2: does not appear in the output.
The output I want to have looks like this:
PHP Code:
<?xml version="1.0" encoding="UTF-8"?>
<Envelope>
<soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<ns1:SessionHeader xmlns:ns1="urn:enterprise.soap.sforce.com"
soapenv:mustUnderstand="0">
<ns2:sessionId xmlns:ns2="urn:enterprise.soap.sforce.com">1234
</ns2:sessionId>
</ns1:SessionHeader>
</soapenv:Header>
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<logout xmlns="urn:enterprise.soap.sforce.com" />
</soapenv:Body>
</Envelope>
Thank you very much
