Question on xsl The problem is as follows: display the vacation schedule for employees in the form of a table: in the employee row - 48 columns for quarters of the month. The request generates xml, in which for each employee a list of quarters of the month for which holidays are planned is built. It is necessary to display this xml. The task is not quite in my profile, so I use the tool superficially. The problem is as follows: The table header is structured as follows:

<TR> <TD class = "Title">ФИО</TD> <xsl:for-each select = "VOCATIONS_LIST/WEEEK_LIST/WEEK"> <TD><xsl:value-of select=" @ID "/></TD> </xsl:for-each> </TR> 

Next, I want a cycle of employees to display information about vacations, but since for each employee the number of quarters will be limited, how to fill the entire line with 48 weeks? I do not want for each employee to build a list of 48 items and mark the ones for which his vacation coincided

    1 answer 1

    I decided like this, if anyone is interested. True, some redundancy still remained. I do not claim for optimality and correctness of the code

     <TABLE style = "border-width:1px;border-style:solid;border-color:black;"> <TR> <TD class = "Title">ФИО</TD> <xsl:for-each select = "VOCATIONS_LIST/WEEEK_LIST/WEEK"> <TD class="Weeks"><xsl:value-of select=" @ID "/></TD> </xsl:for-each> </TR> <xsl:for-each select = "VOCATIONS_LIST/STAFF_LIST/STAFF"> <TR> <TD><xsl:value-of select="PEOPLE_NAME"/></TD> <xsl:variable name="StaffID" select=" @ID " /> <xsl:for-each select = "../../WEEEK_LIST/WEEK"> <xsl:variable name="WeekID" select=" @ID " /> <TD> <xsl:if test="../../STAFF_LIST/STAFF/PLAN_VOCATION_LIST/WEEK[ @ID =$WeekID][@STAFF_ID=$StaffID]"> <xsl:attribute name="bgcolor">black</xsl:attribute> </xsl:if> <xsl:if test="../../STAFF_LIST/STAFF/VOCATION_LIST/WEEK[ @ID =$WeekID][@STAFF_ID=$StaffID]"> <font style="font-family:Wingdings 3;color:red">&#136;</font> </xsl:if>&#160; </TD> </xsl:for-each> </TR> </xsl:for-each> </TABLE>