Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xml 从包含多个值的行中获取值_Xml_Xslt_Xslt 1.0 - Fatal编程技术网

Xml 从包含多个值的行中获取值

Xml 从包含多个值的行中获取值,xml,xslt,xslt-1.0,Xml,Xslt,Xslt 1.0,这是我的示例消息。 现在,我需要选择此OrderId,在本例中为Test_002,并按如下所示显示它: <?xml version="1.0" encoding="UTF-8"?> <Message messageClass="EntityResponse" sender="BUYER" receiver="SELLER"> <Header messageType="orderResponse" entityType="PurchaseOrde

这是我的示例消息。 现在,我需要选择此OrderId,在本例中为Test_002,并按如下所示显示它:

   <?xml version="1.0" encoding="UTF-8"?>
  <Message messageClass="EntityResponse" sender="BUYER" receiver="SELLER">
      <Header messageType="orderResponse" entityType="PurchaseOrder" entityReference="Test" sendingParty="H1822" destinationParty="FAE_MI002" timestamp="20200113 112929" messageInternalRef="7c1b4c53-f86f-41a2-b579-cd04780a3175" networkOwner="Test"/>
      <Content>
          <Order ID="Test_002" orderType="ServiceContract" issueDate="20200107" statusCode="accepted" buyerParty="H1822" buyerPartyTSId="fe303e43-0691-4934-8a28-b5d1f723ee71" buyerPartyName="Test" buyerCountryCode="NL" buyerPartyCountry="NL" sellerParty="FAE_MI002" sellerPartyTSId="9abb074a-16e6-4c4c-9fda-ef4622cb151f" sellerPartyName="Test" sellercountryCode="NL" sellerPartyCountry="NL" monetaryTotal="600.0" legalMonetaryTotal="726.0" taxTotalAmount="126.0" pricingCurrency="EUR" note="header note" deliveryAddressName="Test" tsWorkflowProfile="Test">
              <DynamicAttribute Name="requestoremployeeid" Value="EmployeeID"/>
              <TaxCategories>
                  <TaxCategory type="VAT" rate="21.0" taxAmount="126.0" taxableAmount="600.0"/>
              </TaxCategories>
              <OrderLine lineID="0001" lineType="original" lineStatusCode="accepted" accountingCost="600.0" item="ItemID-001" description="Item Description" buyerNote="line note" requestedQuantity="12.0" unitCode="EA" orderableUnitFactorRate="2.0" requestedPriceAmount="21.0" priceUnitFactorRate="1.0" requestedDeliveryPeriod="20200130" confirmedQuantity="12.0" confirmedPriceAmount="25.0" confirmedDeliveryPeriod="20200130" accountingLineTaxRate="21.0" requireExpiryDateASNFlag="false" requireBatchNumberASNFlag="false" previousLineStatusCode="changed" persistedPreviousLineStatusCode="changed" lineAfterConfirmFlag="false" lineSplitFlag="N">
                  <DynamicAttribute Name="costcentercode" Value="0012"/>
                  <DynamicAttribute Name="generalledgercode" Value="40500"/>
              </OrderLine>
          </Order>
          <Contact name="User" email="" role="Requestor" profile="BUYER"/>
      </Content>
  </Message>

在四处摆弄之后,我找到了一个新的答案:

    <?xml version="1.0" encoding="UTF-8"?>
<Data>
    <Object Type="Purchase" Action="UpdateOrSkip">
        <Property Name="Id" Value="Test_002"/>
    </Object>
</Data>

这导致:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
    <xsl:output method="xml" encoding="UTF-8"  indent="yes"/>
    <xsl:template match="*">
        <Data>
            <xsl:for-each select="*">
                <Object Type="Purchase" Action="UpdateOrSkip" >
                    <Property Name="Id" Value="{Order/@ID}" />
                </Object>
            </xsl:for-each> 
        </Data>
    </xsl:template>
</xsl:stylesheet>

<?xml version="1.0" encoding="UTF-8"?>
<Data>
    <Object Type="Purchase" Action="UpdateOrSkip">
        <Property Name="Id" Value="Test_ultimo_002"/>
        <Property Name="Context" Value="EmployeeContext.Standard"/>
        <Property Name="Description" Value=""/>
    </Object>
</Data>