Tools, FAQ, Tutorials:
'xsl-transform' Azure API Policy Statement
How to use "xsl-transform" Azure API Policy Statement?
✍: FYIcenter.com
The "xsl-transform" Policy Statement allows you to apply
an XSL transformation to XML in the body of the inbound request
or outbound response.
The "xsl-transform" Policy Statement uses the following syntax:
<xsl-transform>
<parameter name="xxx">abcd</parameter>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
<xsl:param name="xxx" />
<xsl:template match="...">
...
</xsl:template>
...
</xsl:stylesheet>
</xsl-transform>
The "parameter" element allows you to define variables to be used in the XSL transformation.
The "xsl:stylesheet" element starts the XSL transformation definitions.
For example, the following "xsl-transform" Policy Statement insert an attribute of User-Agent="..." into the root element:
<xsl-transform>
<parameter name="User-Agent">@(context.Request.Headers.GetValueOrDefault("User-Agent","non-specified"))</parameter>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
<xsl:param name="User-Agent" />
<xsl:template match="* | @* | node()">
<xsl:copy>
<xsl:if test="self::* and not(parent::*)">
<xsl:attribute name="User-Agent">
<xsl:value-of select="$User-Agent" />
</xsl:attribute>
</xsl:if>
<xsl:apply-templates select="* | @* | node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
</xsl-transform>
⇒ 'set-body' Azure API Policy Statement
⇐ 'json-to-xml' Azure API Policy Statement
2017-12-04, ∼4886🔥, 0💬
Popular Posts:
How To Copy Array Values to a List of Variables in PHP? If you want copy all values of an array to a...
How To Read Data from Keyboard (Standard Input) in PHP? If you want to read data from the standard i...
Where can I download the EPUB 2.0 sample book "The Problems of Philosophy" by Lewis Theme? You can f...
FYIcenter JSON Validator and Formatter is an online tool that checks for syntax errors of JSON text ...
How to build a test service operation to dump everything from the "context.Request" object in the re...