排解 XSL 轉換政策部署錯誤

您正在查看 Apigee Edge 說明文件。
查看 Apigee X 說明文件
資訊

XSLEmpty 資源網址

錯誤訊息

透過 Edge UI 或 Edge Management API 部署 API Proxy 的作業會失敗,並顯示以下錯誤訊息:

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 轉換政策名稱為 xslt

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

螢幕截圖範例

在 Edge UI 中,您會看到如下的彈出式錯誤:

原因

如果 XSL 轉換政策中的 <ResourceURL> 元素為空白,則 API Proxy 的部署作業會失敗。

診斷

檢查錯誤訊息中指出的 XSL 轉換政策中的 <ResourceURL> 元素。如果 <ResourceURL> 元素中未指定資源網址,則造成錯誤。例如,下列 XSL 轉換政策具有空白的 <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 Proxy 部署失敗。

解析度

確認 XSL 轉換政策中的 <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 UI 或 Edge Management API 部署 API Proxy 的作業會失敗,並顯示以下錯誤訊息:

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 轉換政策名稱為 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 UI 中,您會看到如下的彈出式錯誤:

原因

如果 XSL 轉換政策的 <ResourceURL> 元素中指定的資源類型不屬於 xsl 類型,API Proxy 的部署就會失敗。

正確的指定格式,如下所示:

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

例如,如果在 XSL 轉換政策的 <ResourceURL> 元素中將資源類型指定為 jsc (如下所示),則 API Proxy 的部署作業會失敗:

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

診斷

  1. 找出發生錯誤的 XSL 轉換政策名稱。您可以在錯誤訊息中找到這項資訊。舉例來說,在下列錯誤中,政策名稱是 xslt

    XSL xslt: Resource type must be xsl. Context Revision:1;APIProxy:XSLTransform;
    Organization:jdoe-test;Environment:test.
    
  2. 在失敗的 XSL 轉換政策 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 Proxy 部署作業會失敗,並顯示以下錯誤:

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

解析度

確保 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>xsl://my_transform.xsl</ResourceURL>
      <Parameters ignoreUnresolvedVariables="true"/>
      <OutputVariable/>
  </XSL>