XSL Transform policy runtime error troubleshooting

You're viewingApigee Edge documentation.
Go to theApigee X documentation.
info

Note: Was this troubleshooting playbook helpful? Please let us know by clicking Send Feedback.

XSLSourceMessageNotAvailable

Error code

steps.xsl.XSLSourceMessageNotAvailable

Error response body

{    "fault": {        "faultstring": "response message is not available for XSL:policy_name",        "detail": {            "errorcode": "steps.xsl.XSLSourceMessageNotAvailable"        }    }}

Example Error Message

{    "fault": {        "faultstring": "response message is not available for XSL: xslt",        "detail": {            "errorcode": "steps.xsl.XSLSourceMessageNotAvailable"        }    }}

Cause

This error occurs if themessageor string variable specified in the<Source> element of the XSL Transform policy is either:

  • Out of scope (not available in the specific flow where the policy is being executed)
  • Can't be resolved (is not defined)

For example, this error occurs if the XSL Transform policy is supposed to be executedin the request flow, but the<Source> element is set to the response variable,which doesn't exist in the request flow.

Diagnosis

  1. Identify the XSL Transformation policy where the error occurred and the nameof the variable that is not available. You can find both of these items in thefaultstring element of the error response. For example, in the followingfaultstring, the policy name isxslt and the variable isresponse:

    faultstring": "response message is not available for XSL: xslt
  2. In the failed XSL Transform policy XML, verify that the name of the variableset in the<Source> element matches the variable name identified in the faultstring (step #1 above). For example, the following XSL Transform policy specifiesa variable namedresponse in the<Source> element, which matches what's inthe fault string:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>  <XSL async="false" continueOnError="false" enabled="true" name="xslt">  <DisplayName>xslt</DisplayName>      <Properties/>      <ResourceURL>xsl://XSL-Transform.xsl</ResourceURL>      <Source>response</Source>      <Parameters ignoreUnresolvedVariables="false"/>     <OutputVariable/></XSL>
  3. Determine if the variable used in the<Source> element is defined and availablein the flow in which the XSL Transform policy is being executed.

  4. If the variable is either:

    • Out of scope (not available in the specific flow where the policy is beingexecuted) or
    • Can't be resolved (is not defined)

    then that's the cause of the error.

    As an example, let's say the XSL Transform policy shown above is supposed toexecute in the request flow. Recall that theresponse variable is used inthe<Source> element of the example policy. Theresponse variable isavailable only in the response flow.

    Since theresponse variable does not exist in the request flow, you receivethe error code:

    steps.xsl.XSLSourceMessageNotAvailable

Resolution

Ensure that the variable set in the<Source> element of the failed XSL Transformpolicy, is defined and exists in the flow where the policy executes.

To correct the example XSL Transform policy shown above, you could modify the<Source> element to use therequest variable, because it exists in the requestflow:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>  <XSL async="false" continueOnError="false" enabled="true" name="xslt">  <DisplayName>xslt</DisplayName>    <Properties/>    <ResourceURL>xsl://XSL-Transform.xsl</ResourceURL>    <Source>request</Source>    <Parameters ignoreUnresolvedVariables="false"/>   <OutputVariable/></XSL>

XSLEvaluationFailed

Error code

steps.xsl.XSLEvaluationFailed

Error response body

{"fault":{"faultstring":"Evaluation of XSL <var>XSL_file_name</var> failed with reason:\"<var>reason_for_failure</var>","detail":{"errorcode":"steps.xsl.XSLEvaluationFailed"}}}

Example Error Message

{    "fault": {        "faultstring": "Evaluation of XSL XSL-Transform.xsl failed with reason: \"Premature end of document while parsing at line 1(possibly  around char 0)\"",        "detail": {            "errorcode": "steps.xsl.XSLEvaluationFailed"        }    }}

Possible causes

This error occurs if:

  • The input XML payload is unavailable/malformed.
  • The XSLTransform policy fails/is unable to transform the input XML filebased on the transformation rules provided in the XSL file. There could be manydifferent causes for the XSLTransform policy to fail. The reason for failurein the error message will provide more information on the cause. The followingtable lists one such cause for this failure - Invalid Prefix - and is explainedwith an example.
CauseDescription
Input XML Payload unavailableThe input XML payload is not passed or empty.
Malformed Input XMLThe input XML payload is malformed or invalid.
Invalid prefixThe input XML payload has a prefix which is not defined in the XSL file.

Cause: Input XML payload is unavailable

This error occurs if the input XML payload is not passed or the XML payload passedas part of the API request to the API Proxy having XSLTransform policy is empty.

Example Error Message

{    "fault": {        "faultstring": "Evaluation of XSL XSL-Transform.xsl failed with reason: \"Premature end of document while parsing at line 1(possibly  around char 0)\"",        "detail": {            "errorcode": "steps.xsl.XSLEvaluationFailed"        }    }}

Diagnosis

  1. Identify the XSL file which could not be evaluated by the XML Transformpolicy and the reason for failure. If the input XML payload is not passed oris empty, the reason for failure would indicate that there's a Premature endof document while parsing. You can find all this information in thefaultstringelement of the error response. For example, in the followingfaultstring, theXSL file isXSL-Transform.xsl, and the reason for failure isPremature end ofdocument while parsing at line 1 (possibly around char 0). That error meansthat the XML payload is either not passed or is empty.

        "faultstring": "Evaluation of XSL XSL-Transform.xsl failed with reason: \"Premature end of document while parsing at line 1(possibly  around char 0)\""
  2. Determine if the input XML payload that has been passed as part of the requestof is empty. If the input payload is not passed or is empty, then that's the causefor the error.

    In the example request below, the request payload (that is, the request body)that was sent by the user was empty.

    For example:

    curl -v "http://<org>-<env>.apigee.net/v1/xsltransform" -H "Content-Type: application/xml"

    Because the XML input payload is empty, you receive the error:

    "faultstring": "Evaluation of XSL XSL-Transform.xsl failed with reason: \"Premature end of document while parsing at line 1(possibly  around char 0)\""
    Note: The HTTP Content-type header of the source message must be set toapplication/xml,otherwise the policy always returns a success.

Resolution

Ensure that the input passed to XSLTransform policy is a valid XML payload andnon-empty.

To fix the issue with the sample XSLTransform policy, pass a valid XML payload.For example:

  1. Create a file namedcity.xml with the following contents:

    <?xml version="1.0" encoding="UTF-8"?><root>   <City>Bengaluru</City>   <Name>Apigee</Name>   <Pincode>560016</Pincode></root>
  2. Make the API call using a cURL command as follows:

    curl-v"http://<org>-<env>.apigee.net/v1/xsltransform"-H"Content-Type: application/xml"-XPOST-d@city.xml

Cause: Malformed Input XML

The input XML payload passed as part of the API request to the XSLTransform policyis malformed or invalid.

Example Error Message

{"fault":{"faultstring":"EvaluationofXSLXSL-Transform.xslfailedwithreason:\"Unexpected char while looking for open tag ('&lt;') character\"","detail":{"errorcode":"steps.xsl.XSLEvaluationFailed"}}}

Diagnosis

  1. Identify the XSL file which could not be evaluated by the XML Transform policyand the reason for failure. If the input XML payload is malformed, the reason forfailure would indicate that there's an unexpected char. You can find all thisinformation in thefaultstring element of the error response. For example, inthe followingfaultstring, the XSL file isXSL-Transform.xsl, and the reasonfor failure isUnexpected char while looking for open tag ('&lt;') character.That is, the "<" is missing in the XML payload.

    "faultstring":"Evaluation of XSL XSL-Transform.xsl failed with reason: \"Unexpected char while looking for open tag ('&lt;') character\""
  2. Examine the input XML payload passed to the XSLTransform policy and see if ithas valid XML content or not. If the input payload is not valid XML, then that'sthe cause for the error.

    In the example request below, the input payload (that is, the request body)that was sent by the user was invalid.

    For example:

    curl-v"http://<org>-<env>.apigee.net/v1/xsltransform"-H"Content-Type: application/xml"-XPOST-d@city.xml

    Wherecity.xml is:

    {   "City": "Bengaluru",   "Name": "Apigee",   "Pincode": "560016"}

    Because the input payload is JSON and not valid XML, you receive the error:

    "faultstring":"Evaluation of XSL XSL-Transform.xsl failed with reason: \"Unexpected char while looking for open tag ('&lt;') character\""
    Note: The HTTPContent-type header of the source message must be set toapplication/xml, otherwise the policy always returns success.

Resolution

Ensure that the input passed to the XSLTransform policy is a valid XML payloadand non-empty.

To fix the issue with the sample XSLTransform policy, pass a valid XML payload.For example:

  1. Modify the filecity.xml to have the content in XML as shown below:

    <?xml version="1.0" encoding="UTF-8"?><root>   <City>Bengaluru</City>   <Name>Apigee</Name>   <Pincode>560016</Pincode></root>
  2. Make the API call using the cURL command as follows:

    curl-v"http://<org>-<env>.apigee.net/v1/xsltransform"-H"Content-Type: application/xml"-XPOST-d@city.xml

Cause: Invalid prefix

The input XML payload passed to the XSLTransform policy has an element that is notdefined as a prefix in the XSL file specified in the policy.

Example Error Message

{    "fault": {        "faultstring": "Evaluation of XSL XSL-Transform.xsl failed with reason: \"Unresolved Prefix at line 1(possibly  around char 270)\"",        "detail": {            "errorcode": "steps.xsl.XSLEvaluationFailed"        }    }}

Diagnosis

  1. Identify the XSL file that could not be evaluated by the XML Transform policyand the reason for failure. In this case, the reason for failure would indicatethat there is an unresolved prefix at a specific line number in the input XMLpayload. You can find all this information in thefaultstring element of theerror response. For example, in the followingfaultstring, the XSL file isXSL-Transform.xsl, and the reason for failure isUnresolved Prefix and linenumber is1.

    "faultstring":"Evaluation of XSL XSL-Transform.xsl failed with reason: \"Unresolved Prefix at line 1(possibly  around char 270)\""
  2. Examine the content of the XSL file (identified in step #1 above) and the inputXML payload. If the prefix used in the line number (identified in step #1 above) ofinput XML payload does not exist in the XSL file, then that's the cause of the error.

    Here are the sample XSL and the corresponding XML payload that lead to the error:

    XSL-Transform.xsl<xsl:stylesheetxmlns:xsl="http://www.w3.org/1999/XSL/Transform"version="1.0"><xsl:outputmethod="text"/><xsl:variablename="newline"><xsl:text></xsl:text></xsl:variable><xsl:templatematch="/"><xsl:text>&lt;Life&gt;</xsl:text><xsl:value-ofselect="$newline"/><xsl:text>Herearetheodd-numbereditemsfromthelist:</xsl:text><xsl:value-ofselect="$newline"/><xsl:for-eachselect="list/listitem"><xsl:iftest="(position() mod 2) = 1"><xsl:numberformat="1. "/><xsl:value-ofselect="."/><xsl:value-ofselect="$newline"/></xsl:if></xsl:for-each><xsl:text>&lt;/Life&gt;</xsl:text></xsl:template></xsl:stylesheet>

    Input XML Payload

    <?xml version="1.0"?><Life:Books>  <title>A few of my favorite albums</title>  <listitem>Beat Crazy</listitem>  <listitem>Here Come the Warm Jets</listitem>  <listitem>Kind of Blue</listitem>  <listitem>London Calling</listitem></Life:Books>

    The example XML payload shown above contains an element<Life:Books>.Notice that the XSL does not have this prefix. Instead it has the prefix as<xsl:text>&lt;Life&gt;</xsl:text>. Hence you get the error:

    "faultstring":"Evaluation of XSL XSL-Transform.xsl failed with reason: \"Unresolved Prefix at line 1(possibly  around char 270)\""

Resolution

Ensure that the input XML payload passed to the XSLTransform policy has all theelement formats defined as prefixes in the XSL file used in the policy.

To fix the example XML file shown above, you can modify the file as shown below:

Updated Input XML Payload

<?xml version="1.0"?><Life>  <title>A few of my favorite albums</title>  <listitem>Beat Crazy</listitem>  <listitem>Here Come the Warm Jets</listitem>  <listitem>Kind of Blue</listitem>  <listitem>London Calling</listitem></Life>

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-02 UTC.