0
XML代碼:如何將XML數組中的一個特定元素放入FO對象?
<EUseSummary>
<Name>EUSummary</Name>
<Title1 index="1">Proposed</Title1>
<Title1 index="2">Proposed</Title1>
<Title1 index="3">Proposed</Title1>
<Title1 index="4">Standard</Title1>
<Title1 index="5">Standard</Title1>
<Title1 index="6">Standard</Title1>
<Title1 index="7">Compliance</Title1>
<Title1 index="8">CAHP</Title1>
<Title2 index="1">Design</Title2>
<Title2 index="2">Design</Title2>
<Title2 index="3">Design</Title2>
<Title2 index="4">Design</Title2>
<Title2 index="5">Design</Title2>
<Title2 index="6">Design</Title2>
<Title2 index="7">Margin</Title2>
<Title2 index="8">Design</Title2>
<Title3 index="0">End Use</Title3>
<Title3 index="1">Site (kWh)</Title3>
<Title3 index="2">Site (therms)</Title3>
<Title3 index="3">(kTDV/ft²-yr)</Title3>
<Title3 index="4">Site (kWh)</Title3>
<Title3 index="5">Site (therms)</Title3>
<Title3 index="6">(kTDV/ft²-yr)</Title3>
<Title3 index="7">(kTDV/ft²-yr)</Title3>
<Title3 index="8">(kTDV/ft²-yr)</Title3>
<Enduse1 index="0">Space Heating</Enduse1>
<Enduse1 index="1">246</Enduse1>
<Enduse1 index="2">286.5</Enduse1>
<Enduse1 index="3">21.04</Enduse1>
<Enduse1 index="4">255</Enduse1>
<Enduse1 index="5">296.8</Enduse1>
<Enduse1 index="6">21.80</Enduse1>
<Enduse1 index="7">0.76</Enduse1>
<Enduse1 index="8">23.18</Enduse1>
</EUseSummary>
我的XSL代碼一小片粘貼下面。這是在表格中定義一個單元格。我最終想要獲取位置index = 8處的所有Enduse值,並放置在表格的其餘單元格中。現在,我只是需要一些澄清,如何從XML的對象選擇一個特定的值:
<fo:table-row xsl:use-attribute-sets="Row">
<fo:table-cell xsl:use-attribute-sets="dataCell">
<fo:block>
<xsl:value-of select="/SDDXML/Model/Proj/EUseSummary/Enduse1/*[@index=8]"/>
</fo:block>
</fo:table-cell>
我很期待迴歸是一個單元格的值(更大的表,我的天堂」之內牛逼提供了一種用於代碼):23.18
感謝,
搶XSL一本好書,讀它。在Enduse1上做一個模板匹配[@ index ='8'] ... –