使用单个XSLT -multiple Transformation来删除xsi:nil =“true”并拆分XML文件

时间:2016-03-05 06:51:32

标签: xml xslt talend

我们正在尝试使用数据集成工具(talend)编写XML文件 然后,我们在输出的XML上触发了tXSLT(即转换组件)。 基本上,我们希望一次应用两个转换。 那是

拆分XML文件 并从我们的XML文档中删除xsi:nil =“true”元素。

原始XML文件看起来像

它有SalesOrders信息

 <?xml version="1.0" encoding="Windows-1252"?>

<SalesOrders xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xmlfilename.xsd">
  <Orders>
    <OrderHeader>
      <CustomerPoNumber>22195175</CustomerPoNumber>
      <OrderActionType>A</OrderActionType>
      <NewCustomerPoNumber xsi:nil="true"></NewCustomerPoNumber>
      <Supplier xsi:nil="true"></Supplier>
      <Customer>027885</Customer>
      <OrderDate>2016-02-12</OrderDate>
      <InvoiceTerms xsi:nil="true"></InvoiceTerms>
      <Currency xsi:nil="true"></Currency>
      <ShippingInstrs xsi:nil="true"></ShippingInstrs>
      <CustomerName>STAGE STORES DIST CTR 00601</CustomerName>
      <ShipAddress1 xsi:nil="true"></ShipAddress1>
      <ShipAddress2 xsi:nil="true"></ShipAddress2>
      <ShipAddress3 xsi:nil="true"></ShipAddress3>
      <ShipAddress4 xsi:nil="true"></ShipAddress4>
      <ShipAddress5 xsi:nil="true"></ShipAddress5>
      <ShipPostalCode xsi:nil="true"></ShipPostalCode>
      <Email xsi:nil="true"></Email>
      <OrderDiscPercent1 xsi:nil="true"></OrderDiscPercent1>
      <OrderDiscPercent2 xsi:nil="true"></OrderDiscPercent2>
      <OrderDiscPercent3 xsi:nil="true"></OrderDiscPercent3>
      <Warehouse xsi:nil="true"></Warehouse>
      <SpecialInstrs xsi:nil="true"></SpecialInstrs>
      <SalesOrder xsi:nil="true"></SalesOrder>
      <OrderType xsi:nil="true"></OrderType>
      <MultiShipCode xsi:nil="true"></MultiShipCode>
      <ShipAddressPerLine xsi:nil="true"></ShipAddressPerLine>
      <AlternateReference xsi:nil="true"></AlternateReference>
      <Salesperson xsi:nil="true"></Salesperson>
      <Branch xsi:nil="true"></Branch>
      <Area xsi:nil="true"></Area>
      <RequestedShipDate xsi:nil="true"></RequestedShipDate>
      <InvoiceNumberEntered xsi:nil="true"></InvoiceNumberEntered>
      <InvoiceDateEntered xsi:nil="true"></InvoiceDateEntered>
      <OrderComments xsi:nil="true"></OrderComments>
      <Nationality xsi:nil="true"></Nationality>
      <DeliveryTerms xsi:nil="true"></DeliveryTerms>
      <TransactionNature xsi:nil="true"></TransactionNature>
      <TransportMode xsi:nil="true"></TransportMode>
      <ProcessFlag xsi:nil="true"></ProcessFlag>
      <TaxExemptNumber xsi:nil="true"></TaxExemptNumber>
      <TaxExemptionStatus xsi:nil="true"></TaxExemptionStatus>
      <GstExemptNumber xsi:nil="true"></GstExemptNumber>
      <GstExemptionStatus xsi:nil="true"></GstExemptionStatus>
      <CompanyTaxNumber xsi:nil="true"></CompanyTaxNumber>
      <CancelReasonCode xsi:nil="true"></CancelReasonCode>
      <DocumentFormat xsi:nil="true"></DocumentFormat>
      <State xsi:nil="true"></State>
      <CountyZip xsi:nil="true"></CountyZip>
      <City xsi:nil="true"></City>
      <InvoiceWholeOrderOnly xsi:nil="true"></InvoiceWholeOrderOnly>
      <SalesOrderPromoQualifyAction xsi:nil="true"></SalesOrderPromoQualifyAction>
      <SalesOrderPromoSelectAction xsi:nil="true"></SalesOrderPromoSelectAction>
      <GlobalTradePromotionCodes xsi:nil="true"></GlobalTradePromotionCodes>
      <eSignature xsi:nil="true"></eSignature>
      <SalesForceOrderNumber>ORD-380804</SalesForceOrderNumber>
    </OrderHeader>
    <OrderHeader>
      <CustomerPoNumber>22195175</CustomerPoNumber>
      <OrderActionType>A</OrderActionType>
      <NewCustomerPoNumber xsi:nil="true"></NewCustomerPoNumber>
      <Supplier xsi:nil="true"></Supplier>
      <Customer>027885</Customer>
      <OrderDate>2016-02-12</OrderDate>
      <InvoiceTerms xsi:nil="true"></InvoiceTerms>
      <Currency xsi:nil="true"></Currency>
      <ShippingInstrs xsi:nil="true"></ShippingInstrs>
      <CustomerName>STAGE STORES DIST CTR 00601</CustomerName>
      <ShipAddress1 xsi:nil="true"></ShipAddress1>
      <ShipAddress2 xsi:nil="true"></ShipAddress2>
      <ShipAddress3 xsi:nil="true"></ShipAddress3>
      <ShipAddress4 xsi:nil="true"></ShipAddress4>
      <ShipAddress5 xsi:nil="true"></ShipAddress5>
      <ShipPostalCode xsi:nil="true"></ShipPostalCode>
      <Email xsi:nil="true"></Email>
      <OrderDiscPercent1 xsi:nil="true"></OrderDiscPercent1>
      <OrderDiscPercent2 xsi:nil="true"></OrderDiscPercent2>
      <OrderDiscPercent3 xsi:nil="true"></OrderDiscPercent3>
      <Warehouse xsi:nil="true"></Warehouse>
      <SpecialInstrs xsi:nil="true"></SpecialInstrs>
      <SalesOrder xsi:nil="true"></SalesOrder>
      <OrderType xsi:nil="true"></OrderType>
      <MultiShipCode xsi:nil="true"></MultiShipCode>
      <ShipAddressPerLine xsi:nil="true"></ShipAddressPerLine>
      <AlternateReference xsi:nil="true"></AlternateReference>
      <Salesperson xsi:nil="true"></Salesperson>
      <Branch xsi:nil="true"></Branch>
      <Area xsi:nil="true"></Area>
      <RequestedShipDate xsi:nil="true"></RequestedShipDate>
      <InvoiceNumberEntered xsi:nil="true"></InvoiceNumberEntered>
      <InvoiceDateEntered xsi:nil="true"></InvoiceDateEntered>
      <OrderComments xsi:nil="true"></OrderComments>
      <Nationality xsi:nil="true"></Nationality>
      <DeliveryTerms xsi:nil="true"></DeliveryTerms>
      <TransactionNature xsi:nil="true"></TransactionNature>
      <TransportMode xsi:nil="true"></TransportMode>
      <ProcessFlag xsi:nil="true"></ProcessFlag>
      <TaxExemptNumber xsi:nil="true"></TaxExemptNumber>
      <TaxExemptionStatus xsi:nil="true"></TaxExemptionStatus>
      <GstExemptNumber xsi:nil="true"></GstExemptNumber>
      <GstExemptionStatus xsi:nil="true"></GstExemptionStatus>
      <CompanyTaxNumber xsi:nil="true"></CompanyTaxNumber>
      <CancelReasonCode xsi:nil="true"></CancelReasonCode>
      <DocumentFormat xsi:nil="true"></DocumentFormat>
      <State xsi:nil="true"></State>
      <CountyZip xsi:nil="true"></CountyZip>
      <City xsi:nil="true"></City>
      <InvoiceWholeOrderOnly xsi:nil="true"></InvoiceWholeOrderOnly>
      <SalesOrderPromoQualifyAction xsi:nil="true"></SalesOrderPromoQualifyAction>
      <SalesOrderPromoSelectAction xsi:nil="true"></SalesOrderPromoSelectAction>
      <GlobalTradePromotionCodes xsi:nil="true"></GlobalTradePromotionCodes>
      <eSignature xsi:nil="true"></eSignature>
      <SalesForceOrderNumber>ORD-380801</SalesForceOrderNumber>
    </OrderHeader>
    <OrderHeader>
      <CustomerPoNumber>22193037</CustomerPoNumber>
      <OrderActionType>A</OrderActionType>
      <NewCustomerPoNumber xsi:nil="true"></NewCustomerPoNumber>
      <Supplier xsi:nil="true"></Supplier>
      <Customer>027886</Customer>
      <OrderDate>2016-02-11</OrderDate>
      <InvoiceTerms xsi:nil="true"></InvoiceTerms>
      <Currency xsi:nil="true"></Currency>
      <ShippingInstrs xsi:nil="true"></ShippingInstrs>
      <CustomerName>STAGE STORES DIST CTR 05099</CustomerName>
      <ShipAddress1 xsi:nil="true"></ShipAddress1>
      <ShipAddress2 xsi:nil="true"></ShipAddress2>
      <ShipAddress3 xsi:nil="true"></ShipAddress3>
      <ShipAddress4 xsi:nil="true"></ShipAddress4>
      <ShipAddress5 xsi:nil="true"></ShipAddress5>
      <ShipPostalCode xsi:nil="true"></ShipPostalCode>
      <Email xsi:nil="true"></Email>
      <OrderDiscPercent1 xsi:nil="true"></OrderDiscPercent1>
      <OrderDiscPercent2 xsi:nil="true"></OrderDiscPercent2>
      <OrderDiscPercent3 xsi:nil="true"></OrderDiscPercent3>
      <Warehouse xsi:nil="true"></Warehouse>
      <SpecialInstrs xsi:nil="true"></SpecialInstrs>
      <SalesOrder xsi:nil="true"></SalesOrder>
      <OrderType xsi:nil="true"></OrderType>
      <MultiShipCode xsi:nil="true"></MultiShipCode>
      <ShipAddressPerLine xsi:nil="true"></ShipAddressPerLine>
      <AlternateReference xsi:nil="true"></AlternateReference>
      <Salesperson xsi:nil="true"></Salesperson>
      <Branch xsi:nil="true"></Branch>
      <Area xsi:nil="true"></Area>
      <RequestedShipDate xsi:nil="true"></RequestedShipDate>
      <InvoiceNumberEntered xsi:nil="true"></InvoiceNumberEntered>
      <InvoiceDateEntered xsi:nil="true"></InvoiceDateEntered>
      <OrderComments xsi:nil="true"></OrderComments>
      <Nationality xsi:nil="true"></Nationality>
      <DeliveryTerms xsi:nil="true"></DeliveryTerms>
      <TransactionNature xsi:nil="true"></TransactionNature>
      <TransportMode xsi:nil="true"></TransportMode>
      <ProcessFlag xsi:nil="true"></ProcessFlag>
      <TaxExemptNumber xsi:nil="true"></TaxExemptNumber>
      <TaxExemptionStatus xsi:nil="true"></TaxExemptionStatus>
      <GstExemptNumber xsi:nil="true"></GstExemptNumber>
      <GstExemptionStatus xsi:nil="true"></GstExemptionStatus>
      <CompanyTaxNumber xsi:nil="true"></CompanyTaxNumber>
      <CancelReasonCode xsi:nil="true"></CancelReasonCode>
      <DocumentFormat xsi:nil="true"></DocumentFormat>
      <State xsi:nil="true"></State>
      <CountyZip xsi:nil="true"></CountyZip>
      <City xsi:nil="true"></City>
      <InvoiceWholeOrderOnly xsi:nil="true"></InvoiceWholeOrderOnly>
      <SalesOrderPromoQualifyAction xsi:nil="true"></SalesOrderPromoQualifyAction>
      <SalesOrderPromoSelectAction xsi:nil="true"></SalesOrderPromoSelectAction>
      <GlobalTradePromotionCodes xsi:nil="true"></GlobalTradePromotionCodes>
      <eSignature xsi:nil="true"></eSignature>
      <SalesForceOrderNumber>ORD-380813</SalesForceOrderNumber>
    </OrderHeader>
    <OrderDetails>
      <StockLine>
        <CustomerPoLine>9999</CustomerPoLine>
        <LineCancelCode xsi:nil="true"></LineCancelCode>
        <StockCode>JBLC-SMH-16OZ-01</StockCode>
        <StockDescription>SMH JAMAICAN LI COND. 16OZ</StockDescription>
        <Warehouse xsi:nil="true"></Warehouse>
        <CustomersPartNumber xsi:nil="true"></CustomersPartNumber>
        <OrderQty>3.0</OrderQty>
        <OrderUom>EA</OrderUom>
        <Price>7.14</Price>
        <PriceUom>EA</PriceUom>
        <PriceCode xsi:nil="true"></PriceCode>
        <AlwaysUsePriceEntered>Y</AlwaysUsePriceEntered>
        <Units xsi:nil="true"></Units>
        <Pieces xsi:nil="true"></Pieces>
        <ProductClass xsi:nil="true"></ProductClass>
        <LineDiscPercent1 xsi:nil="true"></LineDiscPercent1>
        <LineDiscPercent2 xsi:nil="true"></LineDiscPercent2>
        <LineDiscPercent3 xsi:nil="true"></LineDiscPercent3>
        <AlwaysUseDiscountEntered xsi:nil="true"></AlwaysUseDiscountEntered>
        <CustRequestDate xsi:nil="true"></CustRequestDate>
        <CommissionCode xsi:nil="true"></CommissionCode>
        <LineShipDate xsi:nil="true"></LineShipDate>
        <LineDiscValue xsi:nil="true"></LineDiscValue>
        <LineDiscValFlag xsi:nil="true"></LineDiscValFlag>
        <OverrideCalculatedDiscount xsi:nil="true"></OverrideCalculatedDiscount>
        <UserDefined>18</UserDefined>
        <NonStockedLine xsi:nil="true"></NonStockedLine>
        <NsProductClass xsi:nil="true"></NsProductClass>
        <NsUnitCost xsi:nil="true"></NsUnitCost>
        <UnitMass xsi:nil="true"></UnitMass>
        <UnitVolume xsi:nil="true"></UnitVolume>
        <StockTaxCode xsi:nil="true"></StockTaxCode>
        <StockNotTaxable xsi:nil="true"></StockNotTaxable>
        <StockFstCode xsi:nil="true"></StockFstCode>
        <StockNotFstTaxable xsi:nil="true"></StockNotFstTaxable>
        <AllocationAction xsi:nil="true"></AllocationAction>
        <ConfigPrintInv xsi:nil="true"></ConfigPrintInv>
        <ConfigPrintDel xsi:nil="true"></ConfigPrintDel>
        <ConfigPrintAck xsi:nil="true"></ConfigPrintAck>
        <TariffCode xsi:nil="true"></TariffCode>
        <LineMultiShipCode xsi:nil="true"></LineMultiShipCode>
        <SupplementaryUnitsFactor xsi:nil="true"></SupplementaryUnitsFactor>
        <ReserveStock xsi:nil="true"></ReserveStock>
        <ReserveStockRequestAllocs xsi:nil="true"></ReserveStockRequestAllocs>
        <TradePromotionCodes xsi:nil="true"></TradePromotionCodes>
      </StockLine>
    </OrderDetails>
  </Orders>
</SalesOrders>

我们试过了 关注xslt样式表: **

它讲述了两个模板。但是当我同时申请这两个时 这对我们不起作用。它只拆分XML但没有从原始XML中删除xsi:nil =“true”元素。 但是当我单独申请时,会从文件中删除标签xsi:nil =“true”。

以下是XSL文件的说明

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:output encoding="Windows-1252"/>
<xsl:template match="*/@*"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/">
        <xsl:for-each-group select="SalesOrders/Orders" group-by="OrderHeader">
            <xsl:result-document href="SORTOIDOC{position()}.xml">
                <SalesOrders>
                    <xsl:copy-of select="current-group()"/>
                </SalesOrders>
            </xsl:result-document>
        </xsl:for-each-group>
    </xsl:template>
</xsl:stylesheet>

**

每个拆分的XML的OutPut应该在拆分和删除xsi后显示:nil

**<?xml version="1.0" encoding="Windows-1252"?>

<SalesOrders xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance" xsd:noNamespaceSchemaLocation="xmlfilename.XSD">
<Orders>
    <OrderHeader>
      <CustomerPoNumber>C1000</CustomerPoNumber>
      <OrderActionType>A</OrderActionType>
      <NewCustomerPoNumber/>
      <Supplier/>
      <Customer>000010</Customer>
      <OrderDate>2006-11-04</OrderDate>
      <InvoiceTerms>0</InvoiceTerms>
      <Currency>$</Currency>
      <ShippingInstrs>Ship via Hong Kong</ShippingInstrs>
      <CustomerName>The SYSPRO Outdoors Company</CustomerName>
      <ShipAddress1>This is the alternate delivery address 1</ShipAddress1>
      <ShipAddress2>This is the alternate delivery address 2</ShipAddress2>
      <ShipAddress3>This is the alternate delivery address 3</ShipAddress3>
      <ShipAddress4>This is the alternate delivery address 4</ShipAddress4>
      <ShipAddress5>This is the alternate delivery address 5</ShipAddress5>
      <ShipPostalCode>90210</ShipPostalCode>
      <Email>Sender001@Sender001.com</Email>
      <OrderDiscPercent1>2.50</OrderDiscPercent1>
      <OrderDiscPercent2>1.50</OrderDiscPercent2>
      <OrderDiscPercent3>1.00</OrderDiscPercent3>
      <Warehouse>E</Warehouse>
      <SpecialInstrs>Handle with care</SpecialInstrs>
      <SalesOrder>221124</SalesOrder>
      <OrderType>1</OrderType>
      <MultiShipCode/>
      <ShipAddressPerLine/>
      <AlternateReference/>
      <Salesperson>100</Salesperson>
      <Branch/>
      <Area/>
      <RequestedShipDate>2006-12-20</RequestedShipDate>
      <InvoiceNumberEntered/>
      <InvoiceDateEntered/>
      <OrderComments/>
      <Nationality/>
      <DeliveryTerms/>
      <TransactionNature/>
      <TransportMode/>
      <ProcessFlag/>
      <TaxExemptNumber/>
      <TaxExemptionStatus/>
      <GstExemptNumber/>
      <GstExemptionStatus/>
      <CompanyTaxNumber/>
      <CancelReasonCode/>
      <DocumentFormat/>
      <State/>
      <CountyZip/>
      <City/>
      <InvoiceWholeOrderOnly/>
      <SalesOrderPromoQualifyAction>W</SalesOrderPromoQualifyAction>
      <SalesOrderPromoSelectAction>A</SalesOrderPromoSelectAction>
      <GlobalTradePromotionCodes>GLACC,GLFREE</GlobalTradePromotionCodes>
      <eSignature/>
    </OrderHeader>
    <OrderDetails>
      <StockLine>
        <CustomerPoLine>1</CustomerPoLine>
        <LineActionType>A</LineActionType>
        <LineCancelCode/>
        <StockCode>B100</StockCode>
        <StockDescription>Bicycle</StockDescription>
        <Warehouse>FG</Warehouse>
        <CustomersPartNumber>FF334221</CustomersPartNumber>
        <OrderQty>5</OrderQty>
        <OrderUom>EA</OrderUom>
        <Price>400</Price>
        <PriceUom>EA</PriceUom>
        <PriceCode/>
        <AlwaysUsePriceEntered/>
        <Units/>
        <Pieces/>
        <ProductClass/>
        <LineDiscPercent1>0.5</LineDiscPercent1>
        <LineDiscPercent2>0</LineDiscPercent2>
        <LineDiscPercent3>0</LineDiscPercent3>
        <AlwaysUseDiscountEntered>N</AlwaysUseDiscountEntered>
        <CustRequestDate>2006-12-20</CustRequestDate>
        <CommissionCode/>
        <LineShipDate/>
        <LineDiscValue>0</LineDiscValue>
        <LineDiscValFlag/>
        <OverrideCalculatedDiscount/>
        <UserDefined>USER</UserDefined>
        <NonStockedLine/>
        <NsProductClass>NSPR</NsProductClass>
        <NsUnitCost/>
        <UnitMass/>
        <UnitVolume/>
        <StockTaxCode/>
        <StockNotTaxable/>
        <StockFstCode/>
        <StockNotFstTaxable/>
        <AllocationAction/>
        <ConfigPrintInv/>
        <ConfigPrintDel/>
        <ConfigPrintAck/>
        <TariffCode/>
        <LineMultiShipCode/>
        <SupplementaryUnitsFactor/>
        <ReserveStock/>
        <ReserveStockRequestAllocs/>
        <TradePromotionCodes>BIKEACCR,FREE1</TradePromotionCodes>
      </StockLine>
   </OrderDetails>
  </Orders>
</SalesOrders>**

非常感谢任何帮助。

提前致谢

2 个答案:

答案 0 :(得分:1)

这是我的尝试:

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" indent="yes"/>
    <xsl:output encoding="Windows-1252"/>

    <!-- remove attribute templates -->
    <xsl:template match="node()" mode="removeAttr">
        <xsl:copy>
            <xsl:apply-templates select="node()" mode="removeAttr"/>
        </xsl:copy>
    </xsl:template>
    <!-- ************** -->
    <xsl:template match="/">
        <xsl:variable name="phase1" as="node()+">
            <xsl:apply-templates select="node()" mode="removeAttr"/>
        </xsl:variable>

        <xsl:for-each-group select="$phase1/Orders" group-by="OrderHeader">
            <xsl:result-document href="SORTOIDOC{position()}.xml">
                <SalesOrders>
                    <xsl:copy-of select="current-group()"/>
                </SalesOrders>
            </xsl:result-document>
        </xsl:for-each-group>
    </xsl:template>
</xsl:stylesheet>
  1. 在这里,您创建一个临时变量phase1,通过删除属性将文档转换为它(检查模板上的mode属性和应用模板以应用所需的模板)。
  2. 然后再转换变量以完成拆分。

答案 1 :(得分:1)

  

它讲述了两个模板。但是当我申请两个时   同时它对我们不起作用。它只拆分XML但没有   从原始XML中删除xsi:nil =“true”元素。

那是因为你的前两个模板永远不会被应用。您的最后一个模板(与根/节点匹配的模板)是第一个要执行的模板 - 此模板不包含任何xsl:apply-templates指令。

如果你改变:

<xsl:copy-of select="current-group()"/>

为:

<xsl:apply-templates select="current-group()"/>

您将获得预期的结果。

P.S。请注意您的第一个模板:

<xsl:template match="*/@*"/>

将删除所有属性,而不仅仅是您问题中所述的xsi:nil ="true"属性。为了使其按照所述完全工作,需要将其更改为:

<xsl:template match="@xsi:nil[.='true']" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>

加了:

  

问题在于拆分位于的文件命名空间前缀   <Orders xmlns:xsi="w3.org/2001/XMLSchema-instance">;代替   <SalesOrders>根元素

为避免这种情况,请更改:

<xsl:copy>

为:

<xsl:copy copy-namespaces="no">

总而言之,您的样式表应如下所示:

XSLT 2.0

<xsl:stylesheet version="2.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="Windows-1252" indent="yes"/>

<xsl:template match="@xsi:nil[.='true']" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>

<xsl:template match="@*|node()">
    <xsl:copy copy-namespaces="no">
        <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
</xsl:template>

<xsl:template match="/">
    <xsl:for-each-group select="SalesOrders/Orders" group-by="OrderHeader">
        <xsl:result-document href="SORTOIDOC{position()}.xml">
            <SalesOrders xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance" xsd:noNamespaceSchemaLocation="xmlfilename.XSD">
                <xsl:apply-templates select="current-group()"/>
            </SalesOrders>
        </xsl:result-document>
    </xsl:for-each-group>
</xsl:template>

</xsl:stylesheet>

已添加2:

恕我直言,您向我们展示的分裂正如您声称的那样正常工作。但这应该是另一个问题。