要求メッセージの詳細仕様は、名前でフィールドがあります。IgnoreEmptyElementIndはブール型です。そのフィールドがTrueの場合、要求メッセージの空の要素フィールドを無視する必要があり、 "-111"などのデフォルト値がデフォルト値として設定されます。 falseの場合、空の要素を削除する必要はありません。デフォルト値が見つかると通知されます。 IgnoreEmptyElementIndの値がIgnoreEmptyElementIndの値が、その後、出力SHD 偽であれば、出力SHDがXSLTを使用してXMLメッセージの空の要素フィールドとデフォルト値を削除します
<SampleUpdRq>
<RqUID>00000000-0000-0000-0000-000000000000</RqUID>
<UpdMsgRqHdr>
<ContextRqHdr>
<RsSelURL>111</RsSelURL>
<NetworkTrnData>
<TerminalIdent>a</TerminalIdent>
<Name>111</Name>
</NetworkTrnData>
<ClientApp>
<Org>dweer</Org>
<Name>aaaaaaaaaaaaaaaaaaa</Name>
<Version>112</Version>
<Channel>abc</Channel>
</ClientApp>
</ContextRqHdr>
<IgnoreEmptyElementInd>true</IgnoreEmptyElementInd>
</UpdMsgRqHdr>
<SampleKeys>
<SampleId>aaaaaaaaaaaaaaaaaaa</SampleId>
<AltSampleIdentifiers>
<SampleIdent>
<SampleIdentType>Default Found</SampleIdentType>
<SampleIdentValue>ttttttt</SampleIdentValue>
</SampleIdent>
</AltSampleIdentifiers>
<SampleType>
<SampleTypeValue>MMA</SampleTypeValue>
<SampleTypeSrc>bbc</SampleTypeSrc>
</SampleType>
<CommercialSampleType>Default Found</CommercialSampleType>
<COID>aaaaa</COID>
</SampleKeys>
</SampleUpdRq>
ようになり、真ある場合
私の入力メッセージが
<SampleUpdRq>
<RqUID>00000000-0000-0000-0000-000000000000</RqUID>
<UpdMsgRqHdr>
<ContextRqHdr>
<RsSelURL>111</RsSelURL>
<NetworkTrnData>
<TerminalIdent>a</TerminalIdent>
<Name>111</Name>
</NetworkTrnData>
<ClientApp>
<Org>dweer</Org>
<Name>aaaaaaaaaaaaaaaaaaa</Name>
<Version>112</Version>
<Channel>abc</Channel>
</ClientApp>
</ContextRqHdr>
<IgnoreEmptyElementInd>true</IgnoreEmptyElementInd>
</UpdMsgRqHdr>
<SampleKeys>
<SampleId>aaaaaaaaaaaaaaaaaaa</SampleId>
<AltSampleIdentifiers>
<SampleIdent>
<SampleIdentType>-111</SampleIdentType>
<SampleIdentValue>ttttttt</SampleIdentValue>
</SampleIdent>
<SampleIdentType/>
</AltSampleIdentifiers>
<SampleType>
<SampleTypeValue>MMA</SampleTypeValue>
<SampleTypeSrc>bbc</SampleTypeSrc>
<CommercialSampleType></CommercialSampleType>
</SampleType>
<CommercialSampleType>-111</CommercialSampleType>
<COID>aaaaa</COID>
</SampleKeys>
</SampleUpdRq>
ですbe like
<SampleUpdRq>
<RqUID>00000000-0000-0000-0000-000000000000</RqUID>
<UpdMsgRqHdr>
<ContextRqHdr>
<RsSelURL>111</RsSelURL>
<NetworkTrnData>
<TerminalIdent>a</TerminalIdent>
<Name>111</Name>
</NetworkTrnData>
<ClientApp>
<Org>dweer</Org>
<Name>aaaaaaaaaaaaaaaaaaa</Name>
<Version>112</Version>
<Channel>abc</Channel>
</ClientApp>
</ContextRqHdr>
<IgnoreEmptyElementInd>false</IgnoreEmptyElementInd>
</UpdMsgRqHdr>
<SampleKeys>
<SampleId>aaaaaaaaaaaaaaaaaaa</SampleId>
<AltSampleIdentifiers>
<SampleIdent>
<SampleIdentType>Default Found</SampleIdentType>
<SampleIdentValue>ttttttt</SampleIdentValue>
</SampleIdent>
<SampleIdentType/>
</AltSampleIdentifiers>
<SampleType>
<SampleTypeValue>MMA</SampleTypeValue>
<SampleTypeSrc>bbc</SampleTypeSrc>
<CommercialSampleType/>
</SampleType>
<CommercialSampleType>Default Found</CommercialSampleType>
<COID>aaaaa</COID>
</SampleKeys>
</SampleUpdRq>
私はこのようなXSLを書かれている:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="*[not(node())]" />
<xsl:template match="*[. = '-111']">
<xsl:copy>
<xsl:text>Default Found</xsl:text>
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
は本当に専門知識の助けと混乱を気の毒に感謝。前もって感謝します。
最初のXSLTサンプルに 'version =" 2.0 "'がありますが、XSLT 2.0プロセッサを使用していますか?また、代表的なXML入力サンプルとそれに対応する結果を投稿してから、それを解決するための正しいXSLTの方法を提案することもできます。 –
要素の削除に使用する条件を定義する必要があります。質問を編集して追加してください。 –
@Vinay:** IgnoreEmptyElementInd **はXML文書全体に適用されるのですか、** UpdMsgRqHdr **要素にのみ適用されますか? –