Can you clarify further?
What is contained within the context variable āheadersā?
When you say āI need to use the data(headers) in xsltā⦠do you mean you wish to use the data as XSLT parameters? Or as the source (input) to the XSLT ?
Parameters
If you want to use the value of a context variable inside an XSL parameter, then the syntax is like this:
XSL policy:
<XSL name="XSL-XformRequest">
<OutputVariable>request.content</OutputVariable>
<Parameters ignoreUnresolvedVariables="true">
<Parameter name="param1" ref="context-variable-goes-here"/>
<Parameter name="param2" ref="another-context-variable-here"/>
</Parameters>
<ResourceURL>xsl://XformRequest.xsl</ResourceURL>
<Source>request</Source>
</XSL>
and the XSL itself looks like:
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
>
<xsl:param name="param1" select="''"/>
<xsl:param name="param2" select="''"/>
<xsl:output
method="xml"
omit-xml-declaration="yes"
indent="no"
media-type="string"/>
...
Source
If you want to use the context variable as an XML source for the XSLT, then you need to store it in the content of a Message. The XSL policy accepts a Source element, and the value of the Source element must be a variable name. The variable must be of type āMessageā. The body of the Message must be XML and the content-type must be application/xml. In JS, setting the appropriate Message looks like this:
var bodyXml = '<root><child1/><child2/></root>';
var req = new Request('http://foo/bar', // value does not matter
'POST',
{'Content-Type':'application/xml'},
bodyXml);
context.setVariable('myRequest', myRequest);
ā¦and then you would configure your XSL policy like this:
<XSL name="XSL-XformRequest">
<OutputVariable>request.content</OutputVariable>
<ResourceURL>xsl://XformRequest.xsl</ResourceURL>
<Source>myRequest</Source>
</XSL>
ā¦and the XSL can be whatever you like.
The actual values for the verb (āPOSTā in my example) and the URL (āhttp://foo/barā in my example) donāt matter, for the purposes of the XSL. You just need the body content and the content-type.
On further consideration, I think the verb should not matter but⦠a body applies only to PUT or POST, so it is possible that one of those two verbs is required.