0
入力:私がしようとxsltは子属性を親に移動し、最初の行を削除します。
<Conductor Tag="A111K" Type="Normal" Length="7481" Length_Status="Real" Gauge="0.5" Wire_Type="08NtyH" Class="" Segregation="2A" TemperatureZone="20" Net="163K" Description="" Material="Undefined" MaterialType="Copper" ExternalDiameter="8.8" ProvidedWithEquipment="No" Color="BU" TagType="Standard" WireOrder="0" SourceType="Automatic" ManualAssignation="No" Resistivity="0" XDirectionLength="5497">
<UserAttribute AttributeName="NeoNetTAG" AttributeValue="blabla_018" />
<UserAttribute AttributeName="NeoWireTAG" AttributeValue="xxxxxxx_02" />
<MFConductorExtremityFrom/>
</Conductor>
が出力
<Conductor AttributeValue="xxxxxxx_02" Tag="A111K" Type="Normal" Length="7481" Length_Status="Real" Gauge="0.5" Wire_Type="08NtyH" Class="" Segregation="2A" TemperatureZone="20" Net="163K" Description="" Material="Undefined" MaterialType="Copper" ExternalDiameter="8.8" ProvidedWithEquipment="No" Color="BU" TagType="Standard" WireOrder="0" SourceType="Automatic" ManualAssignation="No" Resistivity="0" XDirectionLength="5497">
<MFConductorExtremityFrom/>
</Conductor>
:XSLTをだけの両方を削除:(
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="Conductor">
<xsl:copy>
<!--
Apply the attributes of the current node and the attributes of all
following siblings (in this case, <address> and <phone>)
-->
<xsl:apply-templates select="@* | following-sibling::*/@*"/>
</xsl:copy>
</xsl:template>
<!-- Drop the <address> and <phone> elements -->
<xsl:template match="AttributeValue"/>
<!--
Identity transform: copy attributes and elements from input document to output
document as is
-->
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
今ながら、私はこのαでてきた - XSLTを持っています主に作業して、不要なノードや属性を削除しましたが、その一部が私を投げています。 助けてください:(
このXSLTを試してみてください。子要素から 'AttributeValue'属性をコピーしているようですが、なぜ' AttributeName'ではないのでしょうか?また、 'MFConductorExtremityFrom'ではなく、なぜ子要素' UserAttribute'が削除されていますか?ありがとう –
このxsltの目標は、あなたの興味に感謝します:remove: AttributeValue = "xxxxxxx_02"のみを<導体に接続します。 MFConductorExtremityより多くの属性があり、それを残す必要があります。 –
aliciavika