How to make sure 5 cells show on each row when using apply-templates
up vote
0
down vote
favorite
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:
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
add a comment |
up vote
0
down vote
favorite
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:
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
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
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:
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
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:
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
xml xslt-1.0
asked Nov 11 at 17:49
Andrew Truckle
5,35942145
5,35942145
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
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.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
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.
add a comment |
up vote
0
down vote
accepted
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.
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
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.
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.
answered Nov 11 at 21:16
Andrew Truckle
5,35942145
5,35942145
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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