How to make sure 5 cells show on each row when using apply-templates










0














This is a work in progress .... I have this CSS file:



body

font-family:'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
font-size: 12pt;


table td
height: 14pt;
border: 1px solid black;
padding: 1mm;


.ElderText

text-align:center;


.CalendarTable

width:100%;
border-collapse:collapse;
border: 1px solid black;


.LableText

font-weight: 700;


.MonthText




.PublisherText




.DateText

font-size: 8pt;


.DateText td

vertical-align: top;



And this XML file:



<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="ElderlyInfirm-Schedule-v1.xsl"?>
<ScheduleData Version="1">
<Labels>
<Month>Month</Month>
<Name>Name</Name>
<Week1>Week 1</Week1>
<Week2>Week 2</Week2>
<Week3>Week 3</Week3>
<Week4>Week 4</Week4>
<Week5>Week 5</Week5>
</Labels>
<Elder Name="1">
<Calendars>
<Calendar Month="November">
<Publishers>
<Publisher Name="a">
<Weeks>
<Week Day="5"/>
<Week Day="12"/>
<Week Day="19"/>
<Week Day="26"/>
</Weeks>
</Publisher>
</Publishers>
</Calendar>
<Calendar Month="December">
<Publishers>
<Publisher Name="a2">
<Weeks>
<Week Day="3"/>
<Week Day="10"/>
<Week Day="17"/>
<Week Day="24"/>
<Week Day="31"/>
</Weeks>
</Publisher>
<Publisher Name="a3">
<Weeks>
<Week Day="3"/>
<Week Day="10"/>
<Week Day="17"/>
<Week Day="24"/>
<Week Day="31"/>
</Weeks>
</Publisher>
</Publishers>
</Calendar>
</Calendars>
</Elder>
<Elder Name="2">
<Calendars>
<Calendar Month="November">
<Publishers>
<Publisher Name="b">
<Weeks>
<Week Day="5"/>
<Week Day="12"/>
<Week Day="19"/>
<Week Day="26"/>
</Weeks>
</Publisher>
</Publishers>
</Calendar>
</Calendars>
</Elder>
<Elder Name="3">
<Calendars>
<Calendar Month="November">
<Publishers>
<Publisher Name="c">
<Weeks>
<Week Day="5"/>
<Week Day="12"/>
<Week Day="19"/>
<Week Day="26"/>
</Weeks>
</Publisher>
</Publishers>
</Calendar>
</Calendars>
</Elder>
<Elder Name="4">
<Calendars>
<Calendar Month="November">
<Publishers>
<Publisher Name="d">
<Weeks>
<Week Day="5"/>
<Week Day="12"/>
<Week Day="19"/>
<Week Day="26"/>
</Weeks>
</Publisher>
</Publishers>
</Calendar>
</Calendars>
</Elder>
</ScheduleData>


And this XSL transformation:



<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
<xsl:output method="html" indent="yes" version="4.01"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
doctype-public="//W3C//DTD XHTML 1.0 Transitional//EN"/>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<link rel="stylesheet" type="text/css" href="ElderlyInfirm-Schedule-v1.css"/>
<title>Report</title>
</head>
<body>
<xsl:apply-templates select="ScheduleData/Elder"/>
</body>
</html>
</xsl:template>

<xsl:template match="Elder">
<p class="ElderText">
<xsl:value-of select="@Name"/>
</p>
<table class="CalendarTable">
<xsl:apply-templates select="Calendars/Calendar"/>
</table>
</xsl:template>

<xsl:template match="Calendar">
<tr>
<td class="LableText">
<xsl:value-of select="/ScheduleData/Labels/Month"/>
</td>
<td class="LableText">
<xsl:value-of select="/ScheduleData/Labels/Name"/>
</td>
<td class="LableText">
<xsl:value-of select="/ScheduleData/Labels/Week1"/>
</td>
<td class="LableText">
<xsl:value-of select="/ScheduleData/Labels/Week2"/>
</td>
<td class="LableText">
<xsl:value-of select="/ScheduleData/Labels/Week3"/>
</td>
<td class="LableText">
<xsl:value-of select="/ScheduleData/Labels/Week4"/>
</td>
<td class="LableText">
<xsl:value-of select="/ScheduleData/Labels/Week5"/>
</td>
</tr>
<xsl:apply-templates select="Publishers/Publisher"/>
</xsl:template>

<xsl:template match="Publisher">
<tr>
<td class="MonthText">
<xsl:choose>
<xsl:when test="position()=1">
<xsl:value-of select="../../@Month"/>
</xsl:when>
<xsl:otherwise>
<xsl:text> </xsl:text>
</xsl:otherwise>
</xsl:choose>
</td>
<td class="PublisherText">
<xsl:value-of select="@Name"/>
</td>
<xsl:apply-templates select="Weeks/Week"/>
</tr>
</xsl:template>

<xsl:template match="Week">
<td>
<span class="DateText">
<xsl:value-of select="@Day"/>
</span>
<br/>
<br/>
</td>
</xsl:template>
</xsl:stylesheet>


It looks like:



Results Transformation



As you can see, some weeks will not have 5 weeks. How do I adjust the script to ensure that all 5 will be drawn, even if no week is present?



At this stage I can change the syntax of the XML file if needed.



I am looking for simplest approach.










share|improve this question


























    0














    This is a work in progress .... I have this CSS file:



    body

    font-family:'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
    font-size: 12pt;


    table td
    height: 14pt;
    border: 1px solid black;
    padding: 1mm;


    .ElderText

    text-align:center;


    .CalendarTable

    width:100%;
    border-collapse:collapse;
    border: 1px solid black;


    .LableText

    font-weight: 700;


    .MonthText




    .PublisherText




    .DateText

    font-size: 8pt;


    .DateText td

    vertical-align: top;



    And this XML file:



    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="ElderlyInfirm-Schedule-v1.xsl"?>
    <ScheduleData Version="1">
    <Labels>
    <Month>Month</Month>
    <Name>Name</Name>
    <Week1>Week 1</Week1>
    <Week2>Week 2</Week2>
    <Week3>Week 3</Week3>
    <Week4>Week 4</Week4>
    <Week5>Week 5</Week5>
    </Labels>
    <Elder Name="1">
    <Calendars>
    <Calendar Month="November">
    <Publishers>
    <Publisher Name="a">
    <Weeks>
    <Week Day="5"/>
    <Week Day="12"/>
    <Week Day="19"/>
    <Week Day="26"/>
    </Weeks>
    </Publisher>
    </Publishers>
    </Calendar>
    <Calendar Month="December">
    <Publishers>
    <Publisher Name="a2">
    <Weeks>
    <Week Day="3"/>
    <Week Day="10"/>
    <Week Day="17"/>
    <Week Day="24"/>
    <Week Day="31"/>
    </Weeks>
    </Publisher>
    <Publisher Name="a3">
    <Weeks>
    <Week Day="3"/>
    <Week Day="10"/>
    <Week Day="17"/>
    <Week Day="24"/>
    <Week Day="31"/>
    </Weeks>
    </Publisher>
    </Publishers>
    </Calendar>
    </Calendars>
    </Elder>
    <Elder Name="2">
    <Calendars>
    <Calendar Month="November">
    <Publishers>
    <Publisher Name="b">
    <Weeks>
    <Week Day="5"/>
    <Week Day="12"/>
    <Week Day="19"/>
    <Week Day="26"/>
    </Weeks>
    </Publisher>
    </Publishers>
    </Calendar>
    </Calendars>
    </Elder>
    <Elder Name="3">
    <Calendars>
    <Calendar Month="November">
    <Publishers>
    <Publisher Name="c">
    <Weeks>
    <Week Day="5"/>
    <Week Day="12"/>
    <Week Day="19"/>
    <Week Day="26"/>
    </Weeks>
    </Publisher>
    </Publishers>
    </Calendar>
    </Calendars>
    </Elder>
    <Elder Name="4">
    <Calendars>
    <Calendar Month="November">
    <Publishers>
    <Publisher Name="d">
    <Weeks>
    <Week Day="5"/>
    <Week Day="12"/>
    <Week Day="19"/>
    <Week Day="26"/>
    </Weeks>
    </Publisher>
    </Publishers>
    </Calendar>
    </Calendars>
    </Elder>
    </ScheduleData>


    And this XSL transformation:



    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
    <xsl:output method="html" indent="yes" version="4.01"
    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
    doctype-public="//W3C//DTD XHTML 1.0 Transitional//EN"/>
    <xsl:template match="/">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
    <link rel="stylesheet" type="text/css" href="ElderlyInfirm-Schedule-v1.css"/>
    <title>Report</title>
    </head>
    <body>
    <xsl:apply-templates select="ScheduleData/Elder"/>
    </body>
    </html>
    </xsl:template>

    <xsl:template match="Elder">
    <p class="ElderText">
    <xsl:value-of select="@Name"/>
    </p>
    <table class="CalendarTable">
    <xsl:apply-templates select="Calendars/Calendar"/>
    </table>
    </xsl:template>

    <xsl:template match="Calendar">
    <tr>
    <td class="LableText">
    <xsl:value-of select="/ScheduleData/Labels/Month"/>
    </td>
    <td class="LableText">
    <xsl:value-of select="/ScheduleData/Labels/Name"/>
    </td>
    <td class="LableText">
    <xsl:value-of select="/ScheduleData/Labels/Week1"/>
    </td>
    <td class="LableText">
    <xsl:value-of select="/ScheduleData/Labels/Week2"/>
    </td>
    <td class="LableText">
    <xsl:value-of select="/ScheduleData/Labels/Week3"/>
    </td>
    <td class="LableText">
    <xsl:value-of select="/ScheduleData/Labels/Week4"/>
    </td>
    <td class="LableText">
    <xsl:value-of select="/ScheduleData/Labels/Week5"/>
    </td>
    </tr>
    <xsl:apply-templates select="Publishers/Publisher"/>
    </xsl:template>

    <xsl:template match="Publisher">
    <tr>
    <td class="MonthText">
    <xsl:choose>
    <xsl:when test="position()=1">
    <xsl:value-of select="../../@Month"/>
    </xsl:when>
    <xsl:otherwise>
    <xsl:text> </xsl:text>
    </xsl:otherwise>
    </xsl:choose>
    </td>
    <td class="PublisherText">
    <xsl:value-of select="@Name"/>
    </td>
    <xsl:apply-templates select="Weeks/Week"/>
    </tr>
    </xsl:template>

    <xsl:template match="Week">
    <td>
    <span class="DateText">
    <xsl:value-of select="@Day"/>
    </span>
    <br/>
    <br/>
    </td>
    </xsl:template>
    </xsl:stylesheet>


    It looks like:



    Results Transformation



    As you can see, some weeks will not have 5 weeks. How do I adjust the script to ensure that all 5 will be drawn, even if no week is present?



    At this stage I can change the syntax of the XML file if needed.



    I am looking for simplest approach.










    share|improve this question
























      0












      0








      0







      This is a work in progress .... I have this CSS file:



      body

      font-family:'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
      font-size: 12pt;


      table td
      height: 14pt;
      border: 1px solid black;
      padding: 1mm;


      .ElderText

      text-align:center;


      .CalendarTable

      width:100%;
      border-collapse:collapse;
      border: 1px solid black;


      .LableText

      font-weight: 700;


      .MonthText




      .PublisherText




      .DateText

      font-size: 8pt;


      .DateText td

      vertical-align: top;



      And this XML file:



      <?xml version="1.0" encoding="UTF-8"?>
      <?xml-stylesheet type="text/xsl" href="ElderlyInfirm-Schedule-v1.xsl"?>
      <ScheduleData Version="1">
      <Labels>
      <Month>Month</Month>
      <Name>Name</Name>
      <Week1>Week 1</Week1>
      <Week2>Week 2</Week2>
      <Week3>Week 3</Week3>
      <Week4>Week 4</Week4>
      <Week5>Week 5</Week5>
      </Labels>
      <Elder Name="1">
      <Calendars>
      <Calendar Month="November">
      <Publishers>
      <Publisher Name="a">
      <Weeks>
      <Week Day="5"/>
      <Week Day="12"/>
      <Week Day="19"/>
      <Week Day="26"/>
      </Weeks>
      </Publisher>
      </Publishers>
      </Calendar>
      <Calendar Month="December">
      <Publishers>
      <Publisher Name="a2">
      <Weeks>
      <Week Day="3"/>
      <Week Day="10"/>
      <Week Day="17"/>
      <Week Day="24"/>
      <Week Day="31"/>
      </Weeks>
      </Publisher>
      <Publisher Name="a3">
      <Weeks>
      <Week Day="3"/>
      <Week Day="10"/>
      <Week Day="17"/>
      <Week Day="24"/>
      <Week Day="31"/>
      </Weeks>
      </Publisher>
      </Publishers>
      </Calendar>
      </Calendars>
      </Elder>
      <Elder Name="2">
      <Calendars>
      <Calendar Month="November">
      <Publishers>
      <Publisher Name="b">
      <Weeks>
      <Week Day="5"/>
      <Week Day="12"/>
      <Week Day="19"/>
      <Week Day="26"/>
      </Weeks>
      </Publisher>
      </Publishers>
      </Calendar>
      </Calendars>
      </Elder>
      <Elder Name="3">
      <Calendars>
      <Calendar Month="November">
      <Publishers>
      <Publisher Name="c">
      <Weeks>
      <Week Day="5"/>
      <Week Day="12"/>
      <Week Day="19"/>
      <Week Day="26"/>
      </Weeks>
      </Publisher>
      </Publishers>
      </Calendar>
      </Calendars>
      </Elder>
      <Elder Name="4">
      <Calendars>
      <Calendar Month="November">
      <Publishers>
      <Publisher Name="d">
      <Weeks>
      <Week Day="5"/>
      <Week Day="12"/>
      <Week Day="19"/>
      <Week Day="26"/>
      </Weeks>
      </Publisher>
      </Publishers>
      </Calendar>
      </Calendars>
      </Elder>
      </ScheduleData>


      And this XSL transformation:



      <?xml version="1.0" encoding="utf-8"?>
      <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
      <xsl:output method="html" indent="yes" version="4.01"
      doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
      doctype-public="//W3C//DTD XHTML 1.0 Transitional//EN"/>
      <xsl:template match="/">
      <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
      <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
      <link rel="stylesheet" type="text/css" href="ElderlyInfirm-Schedule-v1.css"/>
      <title>Report</title>
      </head>
      <body>
      <xsl:apply-templates select="ScheduleData/Elder"/>
      </body>
      </html>
      </xsl:template>

      <xsl:template match="Elder">
      <p class="ElderText">
      <xsl:value-of select="@Name"/>
      </p>
      <table class="CalendarTable">
      <xsl:apply-templates select="Calendars/Calendar"/>
      </table>
      </xsl:template>

      <xsl:template match="Calendar">
      <tr>
      <td class="LableText">
      <xsl:value-of select="/ScheduleData/Labels/Month"/>
      </td>
      <td class="LableText">
      <xsl:value-of select="/ScheduleData/Labels/Name"/>
      </td>
      <td class="LableText">
      <xsl:value-of select="/ScheduleData/Labels/Week1"/>
      </td>
      <td class="LableText">
      <xsl:value-of select="/ScheduleData/Labels/Week2"/>
      </td>
      <td class="LableText">
      <xsl:value-of select="/ScheduleData/Labels/Week3"/>
      </td>
      <td class="LableText">
      <xsl:value-of select="/ScheduleData/Labels/Week4"/>
      </td>
      <td class="LableText">
      <xsl:value-of select="/ScheduleData/Labels/Week5"/>
      </td>
      </tr>
      <xsl:apply-templates select="Publishers/Publisher"/>
      </xsl:template>

      <xsl:template match="Publisher">
      <tr>
      <td class="MonthText">
      <xsl:choose>
      <xsl:when test="position()=1">
      <xsl:value-of select="../../@Month"/>
      </xsl:when>
      <xsl:otherwise>
      <xsl:text> </xsl:text>
      </xsl:otherwise>
      </xsl:choose>
      </td>
      <td class="PublisherText">
      <xsl:value-of select="@Name"/>
      </td>
      <xsl:apply-templates select="Weeks/Week"/>
      </tr>
      </xsl:template>

      <xsl:template match="Week">
      <td>
      <span class="DateText">
      <xsl:value-of select="@Day"/>
      </span>
      <br/>
      <br/>
      </td>
      </xsl:template>
      </xsl:stylesheet>


      It looks like:



      Results Transformation



      As you can see, some weeks will not have 5 weeks. How do I adjust the script to ensure that all 5 will be drawn, even if no week is present?



      At this stage I can change the syntax of the XML file if needed.



      I am looking for simplest approach.










      share|improve this question













      This is a work in progress .... I have this CSS file:



      body

      font-family:'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
      font-size: 12pt;


      table td
      height: 14pt;
      border: 1px solid black;
      padding: 1mm;


      .ElderText

      text-align:center;


      .CalendarTable

      width:100%;
      border-collapse:collapse;
      border: 1px solid black;


      .LableText

      font-weight: 700;


      .MonthText




      .PublisherText




      .DateText

      font-size: 8pt;


      .DateText td

      vertical-align: top;



      And this XML file:



      <?xml version="1.0" encoding="UTF-8"?>
      <?xml-stylesheet type="text/xsl" href="ElderlyInfirm-Schedule-v1.xsl"?>
      <ScheduleData Version="1">
      <Labels>
      <Month>Month</Month>
      <Name>Name</Name>
      <Week1>Week 1</Week1>
      <Week2>Week 2</Week2>
      <Week3>Week 3</Week3>
      <Week4>Week 4</Week4>
      <Week5>Week 5</Week5>
      </Labels>
      <Elder Name="1">
      <Calendars>
      <Calendar Month="November">
      <Publishers>
      <Publisher Name="a">
      <Weeks>
      <Week Day="5"/>
      <Week Day="12"/>
      <Week Day="19"/>
      <Week Day="26"/>
      </Weeks>
      </Publisher>
      </Publishers>
      </Calendar>
      <Calendar Month="December">
      <Publishers>
      <Publisher Name="a2">
      <Weeks>
      <Week Day="3"/>
      <Week Day="10"/>
      <Week Day="17"/>
      <Week Day="24"/>
      <Week Day="31"/>
      </Weeks>
      </Publisher>
      <Publisher Name="a3">
      <Weeks>
      <Week Day="3"/>
      <Week Day="10"/>
      <Week Day="17"/>
      <Week Day="24"/>
      <Week Day="31"/>
      </Weeks>
      </Publisher>
      </Publishers>
      </Calendar>
      </Calendars>
      </Elder>
      <Elder Name="2">
      <Calendars>
      <Calendar Month="November">
      <Publishers>
      <Publisher Name="b">
      <Weeks>
      <Week Day="5"/>
      <Week Day="12"/>
      <Week Day="19"/>
      <Week Day="26"/>
      </Weeks>
      </Publisher>
      </Publishers>
      </Calendar>
      </Calendars>
      </Elder>
      <Elder Name="3">
      <Calendars>
      <Calendar Month="November">
      <Publishers>
      <Publisher Name="c">
      <Weeks>
      <Week Day="5"/>
      <Week Day="12"/>
      <Week Day="19"/>
      <Week Day="26"/>
      </Weeks>
      </Publisher>
      </Publishers>
      </Calendar>
      </Calendars>
      </Elder>
      <Elder Name="4">
      <Calendars>
      <Calendar Month="November">
      <Publishers>
      <Publisher Name="d">
      <Weeks>
      <Week Day="5"/>
      <Week Day="12"/>
      <Week Day="19"/>
      <Week Day="26"/>
      </Weeks>
      </Publisher>
      </Publishers>
      </Calendar>
      </Calendars>
      </Elder>
      </ScheduleData>


      And this XSL transformation:



      <?xml version="1.0" encoding="utf-8"?>
      <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
      <xsl:output method="html" indent="yes" version="4.01"
      doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
      doctype-public="//W3C//DTD XHTML 1.0 Transitional//EN"/>
      <xsl:template match="/">
      <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
      <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
      <link rel="stylesheet" type="text/css" href="ElderlyInfirm-Schedule-v1.css"/>
      <title>Report</title>
      </head>
      <body>
      <xsl:apply-templates select="ScheduleData/Elder"/>
      </body>
      </html>
      </xsl:template>

      <xsl:template match="Elder">
      <p class="ElderText">
      <xsl:value-of select="@Name"/>
      </p>
      <table class="CalendarTable">
      <xsl:apply-templates select="Calendars/Calendar"/>
      </table>
      </xsl:template>

      <xsl:template match="Calendar">
      <tr>
      <td class="LableText">
      <xsl:value-of select="/ScheduleData/Labels/Month"/>
      </td>
      <td class="LableText">
      <xsl:value-of select="/ScheduleData/Labels/Name"/>
      </td>
      <td class="LableText">
      <xsl:value-of select="/ScheduleData/Labels/Week1"/>
      </td>
      <td class="LableText">
      <xsl:value-of select="/ScheduleData/Labels/Week2"/>
      </td>
      <td class="LableText">
      <xsl:value-of select="/ScheduleData/Labels/Week3"/>
      </td>
      <td class="LableText">
      <xsl:value-of select="/ScheduleData/Labels/Week4"/>
      </td>
      <td class="LableText">
      <xsl:value-of select="/ScheduleData/Labels/Week5"/>
      </td>
      </tr>
      <xsl:apply-templates select="Publishers/Publisher"/>
      </xsl:template>

      <xsl:template match="Publisher">
      <tr>
      <td class="MonthText">
      <xsl:choose>
      <xsl:when test="position()=1">
      <xsl:value-of select="../../@Month"/>
      </xsl:when>
      <xsl:otherwise>
      <xsl:text> </xsl:text>
      </xsl:otherwise>
      </xsl:choose>
      </td>
      <td class="PublisherText">
      <xsl:value-of select="@Name"/>
      </td>
      <xsl:apply-templates select="Weeks/Week"/>
      </tr>
      </xsl:template>

      <xsl:template match="Week">
      <td>
      <span class="DateText">
      <xsl:value-of select="@Day"/>
      </span>
      <br/>
      <br/>
      </td>
      </xsl:template>
      </xsl:stylesheet>


      It looks like:



      Results Transformation



      As you can see, some weeks will not have 5 weeks. How do I adjust the script to ensure that all 5 will be drawn, even if no week is present?



      At this stage I can change the syntax of the XML file if needed.



      I am looking for simplest approach.







      xml xslt-1.0






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 11 at 17:49









      Andrew Truckle

      5,57552248




      5,57552248






















          1 Answer
          1






          active

          oldest

          votes


















          0














          This works:



           <xsl:template match="Publisher">
          <tr>
          <td class="MonthText">
          <xsl:choose>
          <xsl:when test="position()=1">
          <xsl:value-of select="../../@Month"/>
          </xsl:when>
          <xsl:otherwise>
          <xsl:text> </xsl:text>
          </xsl:otherwise>
          </xsl:choose>
          </td>
          <td class="PublisherText">
          <xsl:value-of select="@Name"/>
          </td>
          <xsl:apply-templates select="Weeks/Week"/>
          <xsl:choose>
          <xsl:when test="count(Weeks/Week)=3">
          <td>
          <xsl:text> </xsl:text>
          </td>
          <td>
          <xsl:text> </xsl:text>
          </td>
          </xsl:when>
          <xsl:when test="count(Weeks/Week)=4">
          <td>
          <xsl:text> </xsl:text>
          </td>
          </xsl:when>
          </xsl:choose>
          </tr>
          </xsl:template>


          I made use of the count function.






          share|improve this answer




















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53251510%2fhow-to-make-sure-5-cells-show-on-each-row-when-using-apply-templates%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            This works:



             <xsl:template match="Publisher">
            <tr>
            <td class="MonthText">
            <xsl:choose>
            <xsl:when test="position()=1">
            <xsl:value-of select="../../@Month"/>
            </xsl:when>
            <xsl:otherwise>
            <xsl:text> </xsl:text>
            </xsl:otherwise>
            </xsl:choose>
            </td>
            <td class="PublisherText">
            <xsl:value-of select="@Name"/>
            </td>
            <xsl:apply-templates select="Weeks/Week"/>
            <xsl:choose>
            <xsl:when test="count(Weeks/Week)=3">
            <td>
            <xsl:text> </xsl:text>
            </td>
            <td>
            <xsl:text> </xsl:text>
            </td>
            </xsl:when>
            <xsl:when test="count(Weeks/Week)=4">
            <td>
            <xsl:text> </xsl:text>
            </td>
            </xsl:when>
            </xsl:choose>
            </tr>
            </xsl:template>


            I made use of the count function.






            share|improve this answer

























              0














              This works:



               <xsl:template match="Publisher">
              <tr>
              <td class="MonthText">
              <xsl:choose>
              <xsl:when test="position()=1">
              <xsl:value-of select="../../@Month"/>
              </xsl:when>
              <xsl:otherwise>
              <xsl:text> </xsl:text>
              </xsl:otherwise>
              </xsl:choose>
              </td>
              <td class="PublisherText">
              <xsl:value-of select="@Name"/>
              </td>
              <xsl:apply-templates select="Weeks/Week"/>
              <xsl:choose>
              <xsl:when test="count(Weeks/Week)=3">
              <td>
              <xsl:text> </xsl:text>
              </td>
              <td>
              <xsl:text> </xsl:text>
              </td>
              </xsl:when>
              <xsl:when test="count(Weeks/Week)=4">
              <td>
              <xsl:text> </xsl:text>
              </td>
              </xsl:when>
              </xsl:choose>
              </tr>
              </xsl:template>


              I made use of the count function.






              share|improve this answer























                0












                0








                0






                This works:



                 <xsl:template match="Publisher">
                <tr>
                <td class="MonthText">
                <xsl:choose>
                <xsl:when test="position()=1">
                <xsl:value-of select="../../@Month"/>
                </xsl:when>
                <xsl:otherwise>
                <xsl:text> </xsl:text>
                </xsl:otherwise>
                </xsl:choose>
                </td>
                <td class="PublisherText">
                <xsl:value-of select="@Name"/>
                </td>
                <xsl:apply-templates select="Weeks/Week"/>
                <xsl:choose>
                <xsl:when test="count(Weeks/Week)=3">
                <td>
                <xsl:text> </xsl:text>
                </td>
                <td>
                <xsl:text> </xsl:text>
                </td>
                </xsl:when>
                <xsl:when test="count(Weeks/Week)=4">
                <td>
                <xsl:text> </xsl:text>
                </td>
                </xsl:when>
                </xsl:choose>
                </tr>
                </xsl:template>


                I made use of the count function.






                share|improve this answer












                This works:



                 <xsl:template match="Publisher">
                <tr>
                <td class="MonthText">
                <xsl:choose>
                <xsl:when test="position()=1">
                <xsl:value-of select="../../@Month"/>
                </xsl:when>
                <xsl:otherwise>
                <xsl:text> </xsl:text>
                </xsl:otherwise>
                </xsl:choose>
                </td>
                <td class="PublisherText">
                <xsl:value-of select="@Name"/>
                </td>
                <xsl:apply-templates select="Weeks/Week"/>
                <xsl:choose>
                <xsl:when test="count(Weeks/Week)=3">
                <td>
                <xsl:text> </xsl:text>
                </td>
                <td>
                <xsl:text> </xsl:text>
                </td>
                </xsl:when>
                <xsl:when test="count(Weeks/Week)=4">
                <td>
                <xsl:text> </xsl:text>
                </td>
                </xsl:when>
                </xsl:choose>
                </tr>
                </xsl:template>


                I made use of the count function.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 11 at 21:16









                Andrew Truckle

                5,57552248




                5,57552248



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53251510%2fhow-to-make-sure-5-cells-show-on-each-row-when-using-apply-templates%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

                    Syphilis

                    Darth Vader #20