XML:
<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="child::*/WorkingTime"/>
我可以以某种方式检查此变量vTransfers
是否08:00
存在于FromTime
. 我不想循环它,因为我需要将它放在正确的TD
行中。我现在在这个 TD 中,我想检查这个数组中是否08:00
存在FromTime
。
我尝试类似
<xsl:when test="contains($vTransfers/ToTime, '08:00')">
<xsl:text>IN</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>OUT</xsl:text>
</xsl:otherwise>
但总是只取第一个而不检查整个数组。