XML:XSLT如何值存儲在陣列
<Calendars xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Urnik.xsd">
<Calendar>
<Name>Marko</Name>
<Days>
<Day>
<Date>2013-05-13</Date>
<DayType>1</DayType>
<DayWorking>1</DayWorking>
<WorkingTimes>
<WorkingTime>
<FromTime>08:00</FromTime>
<ToTime>11:00</ToTime>
<Name>Izpit Matematika</Name>
<Owner>Marko</Owner>
<Category>
<School Professor="111" Room="1" Subject="882" />
</Category>
</WorkingTime>
<WorkingTime>
<FromTime>13:00</FromTime>
<ToTime>17:00</ToTime>
<Name>Vaje APZ</Name>
<Owner>Marko</Owner>
<Category>
<School Professor="222" Room="11" Subject="881"/>
</Category>
</WorkingTime>
<WorkingTime>
<FromTime>20:00</FromTime>
<ToTime>22:00</ToTime>
<Name>Vaje aaaaaa</Name>
<Owner>Marko</Owner>
<Category>
<School Professor="222" Room="11" Subject="881"/>
</Category>
</WorkingTime>
</WorkingTimes>
</Day>
<Day>
<Date>2013-05-14</Date>
<DayType>2</DayType>
...
</Day>
XSLT:
<xsl:for-each select="Calendar/Days/Day">
<xsl:choose>
<xsl:when test="DayType = 1">
<xsl:variable name="vTransfers" select="/*/WorkingTime"/>
<xsl:value-of select="$vTransfers[1]" />
我循環Day
節點。然後我想將所有WorkingTime
節點從DayType = 1
存儲到數組。 不循環,但它在存儲陣列,因爲我會在正確的td標籤
稍後打印但是是空的,但我希望得到:
<WorkingTime>
<FromTime>08:00</FromTime>
<ToTime>11:00</ToTime>
<Name>Izpit Matematika</Name>
<Owner>Marko</Owner>
<Category>
<School Professor="111" Room="1" Subject="882" />
</Category>
</WorkingTime>
你能給我一些線索怎麼樣?
你可能想看看使用msxsl:節點集函數。它似乎會解決你的問題。 – james31rock