XSL transformation and XPath evaluations have special characters that include some of the symbols used in context variables within the CA API Gateway. Typically, a context variable will be referenced in an XPath or XSLT without the encapsulating curly braces. These curly braces are invalid characters in most XML processing tools (such as XPath and XSLT). In order to use context variables in XML processing assertions, certain steps will need to be taken in advance.
All supported versions of the API Gateway
For example, a service policy uses the variable "foo." This is set in policy to the value of "bar." If a policy author or operator wants to leverage the value of the variable "foo" then the following will need to be done:
The value of the "name" attribute in the "param" element will correspond to the name of the context variable in the policy. This element will initialize the variable "foo" in the context of the XSL transformation and set it to the current value of the context variable "foo" in the service policy." The XSL transformation parameter "foo" will then have the value of "bar."
A policy author can then leverage this variable in an XSL transformation with a separate element: <xsl:value-of select="$foo"/>. Note that the variable prefix "$" is used in this context. This specified that "foo" is a context variable to the Gateway's XML message processor.
Policy context variables can also be referenced in an XPath evaluation with the following syntax: [local-name() = $varName]. In this circumstance, a reference to a context variable in policy ("varName") is set in the XPath assertion. If a policy author needed to use a context variable during the evaluation of an XPath then the syntac would be /foo/bar/*[local-name() = $varName].