XSL Transform 政策部署错误问题排查

您正在查看的是 Apigee Edge 文档。
转到 Apigee X 文档
信息

XSLEmptyResourceUrl

错误消息

通过 Edge 界面或 Edge Management API 部署 API 代理失败,并显示以下错误消息:

Error Saving Revision revision_number
Error occurred while validation of bean policy_name.xml. Reason:- Non null
value expected for element ResourceURL in XSL

错误消息示例

在以下错误消息示例中,导致该错误的 XSL Transform 政策的名称是 xslt

Error Saving Revision 1
Error occurred while validation of bean xslt.xml. Reason: - Non null value
expected for element ResourceURL in XSL

示例屏幕截图

在 Edge 界面中,您将看到类似于以下内容的弹出式错误:

原因

如果 XSL Transform 政策中的 <ResourceURL> 元素为空,则 API 代理的部署将失败。

诊断

检查错误消息中命名的 XSL Transform 政策中的 <ResourceURL> 元素。如果 <ResourceURL> 元素中未指定资源网址,则会导致此错误。例如,以下 XSL Transform 政策具有空的 <ResourceURL> 元素:

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

由于 <ResourceURL> 元素为空,因此 API 代理的部署将失败。

分辨率

确保 XSL Transform 政策中的 <ResourceURL> 元素具有指向 XSLT 文件的有效网址。

例如:

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

XSLInvalidResourceType

错误消息

通过 Edge 界面或 Edge Management API 部署 API 代理失败,并显示以下错误消息:

Error Deploying Revision revision_number to env_name
XSL policy_name: Resource type must be xsl. Context Revision:revision_number;
APIProxy:api_proxy_name;Organization:org_name;Environment:env_name.

错误消息示例

在以下错误消息示例中,导致该错误的 XSL Transform 政策的名称是 xslt

Error Deploying Revision 1 to test
XSL xslt: Resource type must be xsl. Context Revision:1;APIProxy:XSLTransform;
Organization:jdoe-test;Environment:test.

示例屏幕截图

在 Edge 界面中,您将看到类似于以下内容的弹出式错误:

原因

如果 XSL Transform 政策的 <ResourceURL> 元素中指定的资源类型不属于 xsl 类型,则 API 代理的部署将失败。

指定资源类型的正确格式如下所示:

<ResourceURL>xsl://<file_name>.xsl</ResourceURL>

例如,如果资源类型在 XSL Transform 政策的 <ResourceURL> 元素中指定为 jsc(如下所示),则 API 代理的部署将失败:

<ResourceURL>jsc://my_transform.xsl</ResourceURL>

诊断

  1. 找出出错的 XL Transform 政策的名称。您可以从错误消息中找到此信息。例如,在以下错误中,政策名称为 xslt

    XSL xslt: Resource type must be xsl. Context Revision:1;APIProxy:XSLTransform;
    Organization:jdoe-test;Environment:test.
    
  2. 在失败的 XSL Transform 政策 XML 中,验证 <ResourceURL> 元素中指定的资源类型是否属于 xsl 类型。如果不属于 xsl 类型,则会导致该错误。

    例如,以下政策在 <ResourceURL> 元素中指定了非 xsl 类型:

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

    由于资源网址被指定为 jsc://my_transform.xsl,但不属于 xsl 类型,因此 API 代理的部署将失败并显示以下错误:

    XSL xslt: Resource type must be xsl. Context Revision:1;APIProxy:XSLTransform;
    Organization:jdoe-test;Environment:test.
    

分辨率

确保 XSL Transform 政策的 <ResourceURL> 元素中指定的资源类型始终属于 xsl 类型。例如:

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