我有下面的XML閱讀的元素,我想選擇儲蓄元素的值時,名稱元素的值是「總」如何根據其他元素值+ XSLT
請讓我知道我該怎麼爲這個特定的場景寫xslt?
</ArrayOfCategoryData>
<CategoryData>
<Category>
<Category>
<Savingsdollar>0.00</Savingsdollar>
<Savingspercentage>0.00</Savingspercentage>
<Savingsusage>0.00</Savingsusage>
</Category>
</Category>
<Name>Refrigeration</Name>
</CategoryData>
<CategoryData>
<Category>
<Category>
<Savingsdollar>999.97</Savingsdollar>
<Savingspercentage>0.00</Savingspercentage>
<Savingsusage>9,998.04</Savingsusage>
</Category>
</Category>
<Name>Total</Name>
</CategoryData>
</ArrayOfCategoryData>
<table cellpadding='0' cellspacing='0'>
<tbody>
<tr>
<td style='border-left: none; border-bottom: none; width: 51px;'>
$ <xsl:value-of select="//ArrayOfCategoryData/CategoryData[Name='Total']//Savingsdollar/text()"/>
</td>
<td style='border-bottom: none; width: 29px;'>
<xsl:value-of select="//ArrayOfCategoryData/CategoryData[Name='Total']//Savingspercentage/text()"/>%
</td>
<td style='border-bottom: none;'>
<xsl:value-of select="//ArrayOfCategoryData/CategoryData[Name='Total']//Savingsusage/text()"/>
</td>
</tr>
</tbody>
</table>
您的意思是xpath? '/ CategoryData [Name ='Total'] // Savings/text()' – 2015-03-19 08:44:41
是的,我需要xpath或者某種方式我想從xslt中獲得這個儲蓄值,我複製了你給它的相同值並沒有顯示出值9.998.04用這個表達式 – 2015-03-19 09:05:54
我已經放置了我的實際xml文件,現在請給我一個xpath或任何條件來讀取「Total」Name元素的任何儲蓄元素值。 – 2015-03-19 09:12:30