-1
我想傳遞一個使用java的屬性值列表,並希望檢查它是否存在於特定節點的屬性中。現在我需要寫一個xslt來實現以下內容,請提供一些指導。XSLT匹配使用Java傳遞的屬性列表
<!-- language: lang-xml -->
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<mtxml>
<Nav>
<DimVal Name="G" Id="10000" Flags="0" dim="10000" DdmName="Gender" >
<Property Key="A">10047</Property>
<Property Key="B">10048</Property>
<Property Key="C">10049</Property>
<Property Key="D">2082</Property>
<Property Key="G">22332</Property>
<Property Key="H">1121</Property>
<Property Key="I">2223</Property>
</DimVal>
<DimVal Name="A" Id="11000" Flags="0" dim="11000" DdmName="Address" >
<Property Key="A">10047</Property>
<Property Key="B">10048</Property>
<Property Key="D">2082</Property>
<Property Key="E">23343</Property>
<Property Key="F">3323</Property>
<Property Key="G">22332</Property>
<Property Key="H">1121</Property>
<Property Key="I">2223</Property>
</DimVal>
<DimVal Name="R" Id="11001" Flags="0" dim="11001" DdmName="Zip" >
<Property Key="A">10047</Property>
<Property Key="B">10048</Property>
<Property Key="C">44532</Property>
<Property Key="D">2082</Property>
<Property Key="E">23343</Property>
<Property Key="F">3323</Property>
<Property Key="G">22332</Property>
<Property Key="H">1121</Property>
<Property Key="I">2223</Property>
</DimVal>
</Nav>
<Nav>
<DimVal Name="GA" Id="90000" Flags="0" dim="90000" DdmName="Age" >
<Property Key="A">10047</Property>
<Property Key="D">2082</Property>
<Property Key="G">22332</Property>
<Property Key="H">1121</Property>
<Property Key="I">2223</Property>
</DimVal>
<DimVal Name="AL" Id="91000" Flags="0" dim="91000" DdmName="Route" >
<Property Key="A">10047</Property>
<Property Key="B">10048</Property>
<Property Key="D">2082</Property>
<Property Key="E">23343</Property>
<Property Key="F">3323</Property>
<Property Key="G">22332</Property>
<Property Key="H">1121</Property>
<Property Key="I">2223</Property>
</DimVal>
<DimVal Name="RW" Id="91001" Flags="0" dim="91001" DdmName="Postal Code" >
<Property Key="A">10047</Property>
<Property Key="B">10048</Property>
<Property Key="C">44532</Property>
<Property Key="D">2082</Property>
<Property Key="F">3323</Property>
<Property Key="G">22332</Property>
<Property Key="H">1121</Property>
</DimVal>
</Nav>
</mtxml>
我會使用以下,其中的parameterValue是陣列/ ArrayList的
<!-- language: lang-java-->
xsltTransformer.setParameter(parameterName, parameterValue);
現在,如果我傳遞{ 'A', 'B', 'C', 'd' 可設置參數, 'E', 'F', 'G', 'H', 'I'}的我會期待XSLT輸出如下:
<!-- language: lang-xml -->
<DimVal Name="G" Id="10000" Flags="0" dim="10000" DdmName="Gender">
<Property Key="E" />
<Property Key="F" />
</DimVal>
<DimVal Name="A" Id="11000" Flags="0" dim="11000" DdmName="Address">
<Property Key="C" />
</DimVal>
<DimVal Name="GA" Id="90000" Flags="0" dim="90000" DdmName="Age" >
<Property Key="B" />
<Property Key="C" />
<Property Key="E" />
<Property Key="F" />
</DimVal>
<DimVal Name="AL" Id="91000" Flags="0" dim="91000" DdmName="Route" >
<Property Key="C" />
</DimVal>
<DimVal Name="RW" Id="91001" Flags="0" dim="91001" DdmName="Postal Code" >
<Property Key="E" />
<Property Key="I" />
</DimVal>
我沒有包含任何XSLT(我做不到工作它),第一XML是輸入XML和第二是預期的輸出。傳遞的參數值是'Property'元素的'Key'屬性的屬性值列表。
要閱讀XLST內部參數,你只需要使用一個頂級'的'。你的'parameterValue'是字符串'「{'A','B','C','D','E','F','G','H','I'}」'?目前還不清楚您是否包含源文檔。這兩份文件都是預期結果嗎如何在與結果XML相關的parameterValue中發送字母? –
helderdarocha
我沒有合併任何xslt,第一個XML是輸入xml,第二個是預期的輸出。傳遞的參數值是'Property'元素的'Key'屬性的屬性值列表。 – Tirtha
如果您沒有合併任何XSLT,那麼您希望如何從'xsltTransformer'獲得任何輸出? – Tomalak