0

XSLT fron フィールドを使用して、別の xml 内に xml を抽出する必要があります。

<?xml version="1.0" encoding="UTF-8" ?> 
<ns:JDBC_SELECT xmlns:ns="namepace/nt">
<row>
<KEY>19</KEY> 
<QUEUE_TYPE>2</QUEUE_TYPE> 
<EVENT_STATUS>0</EVENT_STATUS> 
<EVENT_TYPE>New Work Package Request</EVENT_TYPE> 
<CONTENT><?xml version="1.0" encoding="utf-8" standalone="yes"?><event xmlns:ns="namespace/nt" reference="0000000000" source="NBA" target="SAP" timestamp="2013-02-04T14:32:01.836+00:00" type="New Work Package Request" version="1.0" id="19"><new-work-package-request-event><work-order-id>11</work-order-id><personnel-id>ra_a</personnel-id><request-timestamp>2013-02-04T14:32:01.836+00:00</request-timestamp><new-notification-request><type>Z2</type><requirement-code>RI0D</requirement-code><main-work-centre>0102</main-work-centre><planner-group>L00</planner-group><functional-location-id>1024</functional-location-id><short-text>SET UP/REMOVE ISOLATION RUN</short-text><long-text>SET UP/REMOVE ISOLATION RUN, 1024, NORTON FOXLEY (PRV) NORTON FOXLEY Nightline Increase: (l/h)</long-text><personnel-resp-id>12157</personnel-resp-id><cost-centre>3600</cost-centre></new-notification-request><new-work-order-request><type>ZPM2</type></new-work-order-request></new-work-package-request-event></event></CONTENT> 
</row>
</ns:JDBC_SELECT>

<xsl:transform xmlns:xsl="namespace/nt" version="1.0">
  <xslutput method="xml"/>
  <xsl:template match="/">
    <xsl:copy-of select="//CONTENT"/>
  </xsl:template>
</xsl:transform>

しかし、運ではありません。何か案が?

4

1 に答える 1

0

XML が無効です - 秒を含めることはできません

<?xml version="1.0" encoding="utf-8"?>

要素内での宣言。そのままでは読み込まれません。

XSLT にも問題があります。名前空間は次のようにする必要がありますhttp://www.w3.org/1999/XSL/Transform

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:output method="xml" indent="yes"/>

    <xsl:template match="/">
      <xsl:copy-of select="//CONTENT"/>
    </xsl:template>

</xsl:stylesheet>

<?xml....>XMLの 2 番目の宣言を削除すると、上記の XSLT が機能し、次の出力が生成されます。

<?xml version="1.0" encoding="utf-8"?>
<CONTENT xmlns:ns="namepace/nt">
  <event reference="0000000000" source="NBA" target="SAP" timestamp="2013-02-04T14:32:01.836+00:00" type="New Work Package Request" version="1.0" id="19" xmlns:ns="namespace/nt">
    <new-work-package-request-event>
      <work-order-id>11</work-order-id>
      <personnel-id>ra_a</personnel-id>
      <request-timestamp>2013-02-04T14:32:01.836+00:00</request-timestamp>
      <new-notification-request>
        <type>Z2</type>
        <requirement-code>RI0D</requirement-code>
        <main-work-centre>0102</main-work-centre>
        <planner-group>L00</planner-group>
        <functional-location-id>1024</functional-location-id>
        <short-text>SET UP/REMOVE ISOLATION RUN</short-text>
        <long-text>SET UP/REMOVE ISOLATION RUN, 1024, NORTON FOXLEY (PRV) NORTON FOXLEY Nightline Increase: (l/h)</long-text>
        <personnel-resp-id>12157</personnel-resp-id>
        <cost-centre>3600</cost-centre>
      </new-notification-request>
      <new-work-order-request>
        <type>ZPM2</type>
      </new-work-order-request>
    </new-work-package-request-event>
  </event>
</CONTENT>
于 2013-02-05T14:57:51.177 に答える