Building a table with the values of children whose parents only have siblings with particular attribute values - xslt

I apologize for all of the code, but I couldn't eliminate any more without muddling the clarity of the question.
Suppose I have this XML:
<Dataset>
<Rec RN="FOO">
<Fld FN="ID">ID_1</Fld>
<Fld FN="OPT">0</Fld>
<Fld FN="DESCRIPTION">DESCRIPTION_1</Fld>
</Rec>
<Rec RN="BAR" RC="3">
<Fld FN="ID">ID_2</Fld>
<Fld FN="TYPE">TYPE_1</Fld>
</Rec>
<Rec RN="BAR">
<Fld FN="ID">ID_3</Fld>
<Fld FN="TYPE">TYPE_2</Fld>
</Rec>
<Rec RN="FOO">
<Fld FN="ID">ID_4</Fld>
<Fld FN="OPT">1</Fld>
<Fld FN="DESCRIPTION">DESCRIPTION_2</Fld>
</Rec>
<Rec RN="BAR" RC="3">
<Fld FN="ID">ID_5</Fld>
<Fld FN="TYPE">TYPE_4</Fld>
</Rec>
<Rec RN="BAR">
<Fld FN="ID">ID_6</Fld>
<Fld FN="TYPE">TYPE_5</Fld>
</Rec>
<Rec RN="SPAM">
<Fld FN="CLASS">CLASS_1</Fld>
</Rec>
</Dataset>
And the following XSLT:
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="Dataset">
<html>
<head>
<link rel="stylesheet" type="text/css" href="On-line Styles.css"/>
</head>
<body>
<p class="subheading">
Commands
</p>
<p>
<xsl:choose>
<xsl:when test="Rec[#RN='FOO']">
<xsl:apply-templates select="Rec[#RN='FOO']"/>
</xsl:when>
<xsl:otherwise>
None
</xsl:otherwise>
</xsl:choose>
</p>
</body>
</html>
</xsl:template>
<xsl:template match="Rec[#RN='FOO']">
<xsl:for-each select=".">
<xsl:value-of select="Fld[#FN='ID']"/>
<xsl:if test="Fld[#FN='OPT'] = 1">
(Optional)
</xsl:if>
-
<xsl:value-of select="Fld[#FN='DESCRIPTION']"/>
<p>
<xsl:choose>
<xsl:when test="../Rec[#RN='FOO']">
<table style="border-collapse: separate;" cellspacing="4" border="2"
bordercolorlight="#c0c0c0" bordercolordark="#c0c0c0">
<tr bgcolor="#C0C0C0">
<td style="width: 35%; padding: 6px;" valign="top">
<p class="Tableheader" style="margin-bottom: 0;">
<span style="font-weight: bold;">ID</span>
</p>
</td>
<td style="width: 45%; padding: 6px;" valign="top">
<p class="Tableheader" style="margin-bottom: 0;">
<span style="font-weight: bold;">TYPE</span>
</p>
</td>
</tr>
<xsl:for-each select="../Rec[#RN='BAR']">
<xsl:if test="preceding-sibling::Rec/#RN='FOO'">
<tr>
<td style="padding: 6px;" valign="top">
<p style="margin-bottom: 0;">
<xsl:choose>
<xsl:when test="Fld[#FN='ID']">
<xsl:value-of select="Fld[#FN='ID']"/>
</xsl:when>
<xsl:otherwise>
<td> </td>
</xsl:otherwise>
</xsl:choose>
</p>
</td>
<td style="padding: 6px;" valign="top">
<p style="margin-bottom: 0;">
<xsl:choose>
<xsl:when test="Fld[#FN='TYPE']">
<xsl:value-of select="Fld[#FN='TYPE']"/>
</xsl:when>
<xsl:otherwise>
<td> </td>
</xsl:otherwise>
</xsl:choose>
</p>
</td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</xsl:when>
</xsl:choose>
</p>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
I get the following output for the tables:
Table 1
<table style="border-collapse: separate;" cellspacing="4" border="2" bordercolorlight="#c0c0c0" bordercolordark="#c0c0c0">
<tr bgcolor="#C0C0C0">
<td style="width: 35%; padding: 6px;" valign="top">
<p class="Tableheader" style="margin-bottom: 0;">
<span style="font-weight: bold;">ID</span>
</p>
</td>
<td style="width: 45%; padding: 6px;" valign="top">
<p class="Tableheader" style="margin-bottom: 0;">
<span style="font-weight: bold;">TYPE</span>
</p>
</td>
</tr>
<tr>
<td style="padding: 6px;" valign="top">
<p style="margin-bottom: 0;">ID_2</p>
</td>
<td style="padding: 6px;" valign="top">
<p style="margin-bottom: 0;">TYPE_1</p>
</td>
</tr>
<tr>
<td style="padding: 6px;" valign="top">
<p style="margin-bottom: 0;">ID_3</p>
</td>
<td style="padding: 6px;" valign="top">
<p style="margin-bottom: 0;">TYPE_2</p>
</td>
</tr>
<tr>
<td style="padding: 6px;" valign="top">
<p style="margin-bottom: 0;">ID_5</p>
</td>
<td style="padding: 6px;" valign="top">
<p style="margin-bottom: 0;">TYPE_4</p>
</td>
</tr>
<tr>
<td style="padding: 6px;" valign="top">
<p style="margin-bottom: 0;">ID_6</p>
</td>
<td style="padding: 6px;" valign="top">
<p style="margin-bottom: 0;">TYPE_5</p>
</td>
</tr>
</table>
Table 2
<table style="border-collapse: separate;" cellspacing="4" border="2" bordercolorlight="#c0c0c0" bordercolordark="#c0c0c0">
<tr bgcolor="#C0C0C0">
<td style="width: 35%; padding: 6px;" valign="top">
<p class="Tableheader" style="margin-bottom: 0;">
<span style="font-weight: bold;">ID</span>
</p>
</td>
<td style="width: 45%; padding: 6px;" valign="top">
<p class="Tableheader" style="margin-bottom: 0;">
<span style="font-weight: bold;">TYPE</span>
</p>
</td>
</tr>
<tr>
<td style="padding: 6px;" valign="top">
<p style="margin-bottom: 0;">ID_2</p>
</td>
<td style="padding: 6px;" valign="top">
<p style="margin-bottom: 0;">TYPE_1</p>
</td>
</tr>
<tr>
<td style="padding: 6px;" valign="top">
<p style="margin-bottom: 0;">ID_3</p>
</td>
<td style="padding: 6px;" valign="top">
<p style="margin-bottom: 0;">TYPE_2</p>
</td>
</tr>
<tr>
<td style="padding: 6px;" valign="top">
<p style="margin-bottom: 0;">ID_5</p>
</td>
<td style="padding: 6px;" valign="top">
<p style="margin-bottom: 0;">TYPE_4</p>
</td>
</tr>
<tr>
<td style="padding: 6px;" valign="top">
<p style="margin-bottom: 0;">ID_6</p>
</td>
<td style="padding: 6px;" valign="top">
<p style="margin-bottom: 0;">TYPE_5</p>
</td>
</tr>
</table>
What I need is for each table to only display the ID and TYPE text values for only the <Rec RN="BAR">s following the <Rec RN="FOO"> and before the next <Rec RN="FOO"> or <Rec> with another #RN value. There can be 1 to n number of <Rec RN="BAR"> following a <Rec RN="FOO">. The following example shows the output I need:
Table 1
<table style="border-collapse: separate;" cellspacing="4" border="2" bordercolorlight="#c0c0c0" bordercolordark="#c0c0c0">
<tr bgcolor="#C0C0C0">
<td style="width: 35%; padding: 6px;" valign="top">
<p class="Tableheader" style="margin-bottom: 0;">
<span style="font-weight: bold;">ID</span>
</p>
</td>
<td style="width: 45%; padding: 6px;" valign="top">
<p class="Tableheader" style="margin-bottom: 0;">
<span style="font-weight: bold;">TYPE</span>
</p>
</td>
</tr>
<tr>
<td style="padding: 6px;" valign="top">
<p style="margin-bottom: 0;">ID_2</p>
</td>
<td style="padding: 6px;" valign="top">
<p style="margin-bottom: 0;">TYPE_1</p>
</td>
</tr>
<tr>
<td style="padding: 6px;" valign="top">
<p style="margin-bottom: 0;">ID_3</p>
</td>
<td style="padding: 6px;" valign="top">
<p style="margin-bottom: 0;">TYPE_2</p>
</td>
</tr>
</table>
Table 2
<table style="border-collapse: separate;" cellspacing="4" border="2" bordercolorlight="#c0c0c0" bordercolordark="#c0c0c0">
<tr bgcolor="#C0C0C0">
<td style="width: 35%; padding: 6px;" valign="top">
<p class="Tableheader" style="margin-bottom: 0;">
<span style="font-weight: bold;">ID</span>
</p>
</td>
<td style="width: 45%; padding: 6px;" valign="top">
<p class="Tableheader" style="margin-bottom: 0;">
<span style="font-weight: bold;">TYPE</span>
</p>
</td>
</tr>
<tr>
<td style="padding: 6px;" valign="top">
<p style="margin-bottom: 0;">ID_5</p>
</td>
<td style="padding: 6px;" valign="top">
<p style="margin-bottom: 0;">TYPE_4</p>
</td>
</tr>
<tr>
<td style="padding: 6px;" valign="top">
<p style="margin-bottom: 0;">ID_6</p>
</td>
<td style="padding: 6px;" valign="top">
<p style="margin-bottom: 0;">TYPE_5</p>
</td>
</tr>
</table>

If I understand this correctly (which is not at all certain), you want to do something like this:
XSLT 1.0
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="rows" match="Rec[#RN='BAR']" use="generate-id(preceding-sibling::Rec[#RN='FOO'][1])" />
<xsl:template match="/Dataset">
<html>
<body>
<xsl:apply-templates select="Rec[#RN='FOO']"/>
</body>
</html>
</xsl:template>
<xsl:template match="Rec[#RN='FOO']">
<table border="1">
<tr>
<th>ID</th>
<th>TYPE</th>
</tr>
<xsl:apply-templates select="key('rows', generate-id())"/>
</table>
<p/>
</xsl:template>
<xsl:template match="Rec[#RN='BAR']">
<tr>
<td>
<xsl:value-of select="Fld[#FN='ID']"/>
</td>
<td>
<xsl:value-of select="Fld[#FN='TYPE']"/>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
Applied to your example input, the result will be:
<html>
<body>
<table border="1">
<tr>
<th>ID</th>
<th>TYPE</th>
</tr>
<tr>
<td>ID_2</td>
<td>TYPE_1</td>
</tr>
<tr>
<td>ID_3</td>
<td>TYPE_2</td>
</tr>
</table>
<p></p>
<table border="1">
<tr>
<th>ID</th>
<th>TYPE</th>
</tr>
<tr>
<td>ID_5</td>
<td>TYPE_4</td>
</tr>
<tr>
<td>ID_6</td>
<td>TYPE_5</td>
</tr>
</table>
<p></p>
</body>
</html>
rendered as:

Related

Is there any pre-requisits as a sender to use promotab?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="application/ld+json">
[{
"#context": "http://schema.org/",
"#type": "Organization",
"logo": "https://www.gstatic.com/images/branding/product/1x/googleg_48dp.png"
},{
"#context": "http://schema.org/",
"#type": "EmailMessage",
"subjectLine": "[Important] Please add subject line in annotation"
},{
"#context": "http://schema.org/",
"#type": "DiscountOffer",
"description": "20% off",
"discountCode": "PROMO",
"availabilityStarts": "2021-04-07T09:19:24-07:00",
"availabilityEnds": "2021-04-10T09:19:24-07:00"
},{
"#context": "http://schema.org/",
"#type": "PromotionCard",
"image": "https://www.google.com/gmail-for-marketers/promo-tab/markup-tool/sample.png"
}]
</script>
</head>
<body style="margin: 0px; padding: 0px; min-width: 100%; background-color: rgb(243, 242, 240); cursor: auto;">
<center class="wrapper" style="width:100%;table-layout:fixed;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;background-color:#f3f2f0;">
<table bgcolor="#f3f2f0;" border="0" cellpadding="0" cellspacing="0" style="background-color:#f3f2f0;" width="100%">
<tbody>
<tr>
<td width="100%">
<div class="webkit" style="max-width:600px;Margin:0 auto;"><!--[if (gte mso 9)|(IE)]>
<table width="600" align="center" cellpadding="0" cellspacing="0" border="0" style="border-spacing:0" >
<tr>
<td style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;" >
<![endif]--><!-- ======= start main body ======= -->
<table align="center" border="0" cellpadding="0" cellspacing="0" class="outer" style="border-spacing:0;Margin:0 auto;width:100%;max-width:600px;">
<tbody>
<tr>
<td style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;"><!-- ======= start header ======= -->
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" style="width:100%;">
<tbody>
<tr>
<td align="center">
<center>
<table align="center" border="0" cellpadding="0" cellspacing="0" style="Margin: 0 auto;" width="100%">
<tbody>
<tr>
<td bgcolor="#FFFFFF" class="one-column" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;"><!-- ======= start header ======= -->
<table bgcolor="#f3f2f0" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td class="two-column" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;text-align:left;font-size:0;"><!--[if (gte mso 9)|(IE)]>
<table width="100%" style="border-spacing:0" >
<tr>
<td width="20%" valign="top" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:30px;" >
<![endif]-->
<div class="column" style="width:100%;max-width:80px;display:inline-block;vertical-align:top;">
<table class="contents" style="border-spacing:0; width:100%">
<tbody>
<tr>
<td align="left" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:5px;"><img align="left" alt="" height="60" src="https://gallery.mailchimp.com/fdcaf86ecc5056741eb5cbc18/images/dbe9c57f-5e00-4d9f-9719-5d36a9a02ebc.jpg" style="border-width:0; max-width:60px;height:auto; display:block" width="60" /></td>
</tr>
</tbody>
</table>
</div>
<!--[if (gte mso 9)|(IE)]>
</td><td width="80%" valign="top" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;" >
<![endif]-->
<div class="column" style="width:100%;max-width:518px;display:inline-block;vertical-align:top;">
<table border="0" cellpadding="0" cellspacing="0" style="border-spacing:0" width="100%">
<tbody>
<tr>
<td class="inner" style="padding-top:0px;padding-bottom:10px; padding-right:10px;padding-left:10px;">
<table border="0" cellpadding="0" cellspacing="0" class="contents" style="border-spacing:0; width:100%">
<tbody>
<tr>
<td align="left" valign="top"></td>
</tr>
<tr>
<td align="right" valign="top"><img alt="" height="16" src="https://gallery.mailchimp.com/fdcaf86ecc5056741eb5cbc18/images/c01afe22-e370-4df3-b96e-927714713f51.jpg" style="border-width:0; max-width:20px;height:auto; max-height:16px; padding-top:0px; padding-left:10px" width="20" /><font style="font-size:11px; text-decoration:none; color:#474b53; font-family: Verdana, Geneva, sans-serif; text-align:left; line-height:16px; padding-bottom:30px">View as a web page</font></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]--></td>
</tr>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</center>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!-- ======= end header ======= --><!-- ======= start two column ======= -->
<table bgcolor="#FFFFFF" border="0" cellpadding="0" cellspacing="0" style=" border-left:1px solid #e8e7e5; border-right:1px solid #e8e7e5" width="100%">
<tbody>
<tr>
<td align="center" background="https://gallery.mailchimp.com/fdcaf86ecc5056741eb5cbc18/images/595fac04-56a2-46f4-982e-69600273e5d0.jpg" bgcolor="#1f3ca6" class="two-column" height="260" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;text-align:center;font-size:0" valign="top" width="600"><!--[if gte mso 9]>
<v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="width:600px;height:260px;">
<v:fill type="tile" src="https://gallery.mailchimp.com/fdcaf86ecc5056741eb5cbc18/images/595fac04-56a2-46f4-982e-69600273e5d0.jpg" color="#1f3ca6" />
<v:textbox inset="0,0,0,0">
<![endif]-->
<div><!--[if (gte mso 9)|(IE)]>
<table width="100%" style="border-spacing:0" >
<tr>
<td width="50%" valign="top" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;" >
<![endif]-->
<div class="column" style="width:100%;max-width:299px;display:inline-block;vertical-align:top;">
<table style="border-spacing:0" width="100%">
<tbody>
<tr>
<td class="inner" style="padding-top:20px;padding-bottom:10px; padding-right:10px;padding-left:30px;">
<table class="contents1" style="border-spacing:0; width:100%">
<tbody>
<tr>
<td align="center" style="padding-top:20px; padding-right:30px" valign="middle">
<p style="font-size:30px; text-decoration:none; color:#ffffff; font-family: Verdana, Geneva, sans-serif; text-align:left"><strong>Lorem Ipsum</strong></p>
<p style="font-size:14px; text-decoration:none; color:#ffffff; font-family: Verdana, Geneva, sans-serif; text-align:left; line-height:18px">Consectetur hi $name$ elitsed do eiusmod tempor sitabore et dolore magna aliqua.<br />
<br />
<strong>Read more »</strong></p>
<table align="center" border="0" cellpadding="0" cellspacing="0" style="Margin:0 auto;">
<tbody>
<tr>
<td align="center">
<table border="0" cellpadding="0" cellspacing="0" style="Margin:0 auto;">
<tbody>
<tr>
<td align="center" bgcolor="#ffffff" height="40" style="-moz-border-radius:10px; -webkit-border-radius:10px; border-radius:10px;" width="120"><a class="button_link" href="#" style="width:120; display:block; text-decoration:none; border:0; text-align:center; font-weight:bold;font-size:13px; font-family: Arial, sans-serif; color: #1f3ca6">Read more » </a></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<!--[if (gte mso 9)|(IE)]>
</td><td width="50%" valign="top" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;" >
<![endif]-->
<div class="column" style="width:100%;max-width:299px;display:inline-block;vertical-align:top;">
<table style="border-spacing:0" width="100%">
<tbody>
<tr>
<td align="right" style="padding-top:20px;padding-bottom:0;padding-right:0;padding-left:0;"><img alt="" src="https://gallery.mailchimp.com/fdcaf86ecc5056741eb5cbc18/images/fc68f7b7-efa6-45db-8b6f-ac6f78ae6782.png" style="border-width:0;width:100%; height:auto;" width="290" /></td>
</tr>
</tbody>
</table>
</div>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]--></div>
<!--[if gte mso 9]>
</v:textbox>
</v:rect>
<![endif]--></td>
</tr>
</tbody>
</table>
<!-- ======= end two column ======= --><!-- ======= start two column ======= -->
<table bgcolor="#FFFFFF" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td class="two-column" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;text-align:center;font-size:0;"><!--[if (gte mso 9)|(IE)]>
<table width="100%" style="border-spacing:0" >
<tr>
<td width="50%" valign="top" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;" >
<![endif]-->
<div class="column" style="width:100%;max-width:300px;display:inline-block;vertical-align:top;">
<table bgcolor="#FFFFFF" class="contents" style="border-spacing:0; width:100%">
<tbody>
<tr>
<td align="left"><img alt="" src="https://gallery.mailchimp.com/fdcaf86ecc5056741eb5cbc18/images/c11788a0-0366-43bd-812f-4756c82a6f93.jpg" style="border-width:0;width:100%; height:auto;display:block" width="300" /></td>
</tr>
</tbody>
</table>
</div>
<!--[if (gte mso 9)|(IE)]>
</td><td width="50%" valign="top" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;" >
<![endif]-->
<div class="column" style="width:100%;max-width:300px;display:inline-block;vertical-align:top;">
<table style="border-spacing:0" width="100%">
<tbody>
<tr>
<td class="inner" style="padding-top:0px;padding-bottom:10px; padding-right:20px;padding-left:30px;">
<table class="contents" style="border-spacing:0; width:100%">
<tbody>
<tr>
<td align="center" style="padding-top:20px; padding-right:30px" valign="middle">
<p style="font-size:20px; text-decoration:none; color:#262626; font-family: Verdana, Geneva, sans-serif; text-align:left"><strong>lorem ipsum</strong></p>
<p style="font-size:14px; text-decoration:none; color:#3a3d41; font-family: Verdana, Geneva, sans-serif; text-align:left; line-height:18px">Lorem ipsum dolor lorem cupidat non proident, sunt in culpa qui officia deserunt mollit telaborum.<br />
</p>
<table align="left" border="0" cellpadding="0" cellspacing="0" style="Margin:0 auto;">
<tbody>
<tr>
<td align="center">
<table border="0" cellpadding="0" cellspacing="0" style="Margin:0 auto;">
<tbody>
<tr>
<td align="center" bgcolor="#1f3ca6" height="40" style="-moz-border-radius:10px; -webkit-border-radius:10px; border-radius:10px;" width="120"><a class="button_link" href="#" style="width:120; display:block; text-decoration:none; border:0; text-align:center; font-weight:bold;font-size:13px; font-family: Arial, sans-serif; color: #ffffff">Read more » </a></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p style="font-size:14px; text-decoration:none; color:#3a3d41; font-family: Verdana, Geneva, sans-serif; text-align:left; line-height:18px"></p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]--></td>
</tr>
</tbody>
</table>
<!-- ======= end two column ======= --><!-- ======= start two column ======= -->
<table bgcolor="#FFFFFF" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td class="two-column" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;text-align:center;font-size:0;"><!--[if (gte mso 9)|(IE)]>
<table width="100%" style="border-spacing:0" >
<tr>
<td width="50%" valign="top" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;" >
<![endif]-->
<div class="column" style="width:100%;max-width:299px;display:inline-block;vertical-align:top;">
<table style="border-spacing:0" width="100%">
<tbody>
<tr>
<td class="inner" style="padding-top:0px;padding-bottom:10px; padding-right:20px;padding-left:30px;">
<table class="contents1" style="border-spacing:0; width:100%">
<tbody>
<tr>
<td align="center" style="padding-top:20px; padding-right:30px" valign="middle">
<p style="font-size:20px; text-decoration:none; color:#262626; font-family: Verdana, Geneva, sans-serif; text-align:left"><strong>lorem ipsum</strong></p>
<p style="font-size:14px; text-decoration:none; color:#3a3d41; font-family: Verdana, Geneva, sans-serif; text-align:left; line-height:18px">Lorem ipsum dolor lorem cupidat non proident, sunt in culpa qui officia deserunt mollit telaborum.<br />
</p>
<table align="left" border="0" cellpadding="0" cellspacing="0" style="Margin:0 auto;">
<tbody>
<tr>
<td align="center">
<table border="0" cellpadding="0" cellspacing="0" style="Margin:0 auto;">
<tbody>
<tr>
<td align="center" bgcolor="#1f3ca6" height="40" style="-moz-border-radius:10px; -webkit-border-radius:10px; border-radius:10px;" width="120"><a class="button_link" href="#" style="width:120; display:block; text-decoration:none; border:0; text-align:center; font-weight:bold;font-size:13px; font-family: Arial, sans-serif; color: #ffffff">Read more » </a></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p style="font-size:14px; text-decoration:none; color:#3a3d41; font-family: Verdana, Geneva, sans-serif; text-align:left; line-height:18px"></p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<!--[if (gte mso 9)|(IE)]>
</td><td width="50%" valign="top" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;" >
<![endif]-->
<div class="column" style="width:100%;max-width:300px;display:inline-block;vertical-align:top;">
<table bgcolor="#FFFFFF" class="contents" style="border-spacing:0; width:100%">
<tbody>
<tr>
<td align="left" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;"><img alt="" src="https://gallery.mailchimp.com/fdcaf86ecc5056741eb5cbc18/images/4dccd1e6-3ce2-4fd9-9b94-635e70bb09e2.jpg" style="border-width:0;width:100%; height:auto; display:block" width="300" /></td>
</tr>
</tbody>
</table>
</div>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]--></td>
</tr>
</tbody>
</table>
<!-- ======= end two column ======= --><!-- ======= start two column ======= -->
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td align="center" background="https://gallery.mailchimp.com/fdcaf86ecc5056741eb5cbc18/images/595fac04-56a2-46f4-982e-69600273e5d0.jpg" bgcolor="#1f3ca6" class="two-column" height="200" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;text-align:center;font-size:0" valign="top" width="600"><!--[if gte mso 9]>
<v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="width:600px;height:200px;">
<v:fill type="tile" src="https://gallery.mailchimp.com/fdcaf86ecc5056741eb5cbc18/images/595fac04-56a2-46f4-982e-69600273e5d0.jpg" color="#1f3ca6" />
<v:textbox inset="0,0,0,0">
<![endif]-->
<div><!--[if (gte mso 9)|(IE)]>
<table width="100%" style="border-spacing:0" >
<tr>
<td width="50%" valign="top" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;" >
<![endif]-->
<div class="column" style="width:100%;max-width:299px;display:inline-block;vertical-align:top;">
<table style="border-spacing:0" width="100%">
<tbody>
<tr>
<td class="inner" style="padding-top:20px;padding-bottom:10px; padding-right:10px;padding-left:30px;">
<table class="contents1" style="border-spacing:0; width:100%">
<tbody>
<tr>
<td align="center" style="padding-top:20px; padding-right:30px" valign="middle">
<p style="color:#ffffff; font-size:25px; text-align:center; font-family: Verdana, Geneva, sans-serif; line-height:22px ; text-transform:uppercase">lorem ipsum</p>
<p style="color:#ffffff; font-size:60px; text-align:center; font-family: Verdana, Geneva, sans-serif">40%</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<!--[if (gte mso 9)|(IE)]>
</td><td width="50%" valign="top" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;" >
<![endif]-->
<div class="column" style="width:100%;max-width:299px;display:inline-block;vertical-align:top;">
<table style="border-spacing:0" width="100%">
<tbody>
<tr>
<td align="right" style="padding-top:20px;padding-bottom:0;padding-right:0;padding-left:0;"><img alt="" src="https://gallery.mailchimp.com/fdcaf86ecc5056741eb5cbc18/images/934e8df4-ef47-4dc5-b8e3-a1ccab54963d.png" style="border-width:0;width:100%; height:auto;" width="282" /></td>
</tr>
</tbody>
</table>
</div>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]--></div>
<!--[if gte mso 9]>
</v:textbox>
</v:rect>
<![endif]--></td>
</tr>
</tbody>
</table>
<!-- ======= end two column ======= --><!-- ======= start footer ======= -->
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td height="30"></td>
</tr>
<tr>
<td class="two-column" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;text-align:center;font-size:0;"><!--[if (gte mso 9)|(IE)]>
<table width="100%" style="border-spacing:0" >
<tr>
<td width="60%" valign="top" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;" >
<![endif]-->
<div class="column" style="width:100%;max-width:350px;display:inline-block;vertical-align:top;">
<table class="contents" style="border-spacing:0; width:100%">
<tbody>
<tr>
<td align="right" style="padding-top:0;padding-bottom:0;padding-right:10px;padding-left:0;" width="39%"><img alt="" height="59" src="https://gallery.mailchimp.com/fdcaf86ecc5056741eb5cbc18/images/13f425ab-c680-4ae0-88de-7b493d95095f.jpg" style="border-width:0; max-width:59px;height:auto; display:block; padding-right:20px" width="59" /></td>
<td align="left" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;" valign="middle" width="61%">
<p style="color:#787777; font-size:13px; text-align:left; font-family: Verdana, Geneva, sans-serif">Lorem ipsum © 2017<br />
lorem ipsum lorem ipsum<br />
lorem ipsum lorem ipsum</p>
</td>
</tr>
</tbody>
</table>
</div>
<!--[if (gte mso 9)|(IE)]>
</td><td width="40%" valign="top" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;" > <![endif]-->
<div class="column" style="width:100%;max-width:248px;display:inline-block;vertical-align:top;">
<table style="border-spacing:0" width="100%">
<tbody>
<tr>
<td class="inner" style="padding-top:0px;padding-bottom:10px; padding-right:10px;padding-left:10px;">
<table class="contents" style="border-spacing:0; width:100%">
<tbody>
<tr>
<td align="center" style="padding-top:10px" valign="top" width="32%">
<table border="0" cellpadding="0" cellspacing="0" width="150">
<tbody>
<tr>
<td align="center" width="33"><img alt="facebook" border="0" height="36" src="https://gallery.mailchimp.com/fdcaf86ecc5056741eb5cbc18/images/1f9161ee-46b5-4bdf-86db-9e32d4b98336.jpg" style="border-width:0; max-width:36px;height:auto; display:block; max-height:36px" width="36" /></td>
<td align="center" width="34"><img alt="twitter" border="0" height="36" src="https://gallery.mailchimp.com/fdcaf86ecc5056741eb5cbc18/images/4e449140-ec71-4978-97bf-8e0f15b5ff23.jpg" style="border-width:0; max-width:36px;height:auto; display:block; max-height:36px" width="36" /></td>
<td align="center" width="33"><img alt="linkedin" border="0" height="36" src="https://gallery.mailchimp.com/fdcaf86ecc5056741eb5cbc18/images/d21cca91-335e-4fa4-9313-b0ea37e0452b.jpg" style="border-width:0; max-width:36px;height:auto; display:block; max-height:36px" width="36" /></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<!--[if (gte mso 9)|(IE)]> </td> </tr> </table> <![endif]--></td>
</tr>
<tr>
<td height="30" style="text-align: center;"><span style="font-size:20px;"><span style="color: rgb(39, 65, 107); font-family: engagefont, "Helvetica Neue", "Calibri Light", Roboto, sans-serif, "Microsoft YaHei", 微软雅黑, STXihei, 华文细黑, "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", Osaka, メイリオ, Meiryo, "MS Pゴシック", "MS PGothic", "Malgun Gothic"; background-color: rgb(255, 255, 255);">$unsub$</span></span></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<table align="center" border="0" cellpadding="0" cellspacing="0" class="outer" style="border-spacing:0;Margin:0 auto;width:100%;max-width:600px;">
<tbody>
<tr>
<td style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;"><span style="font-size:20px;"><!-- ======= end footer ======= --></span></td>
</tr>
</tbody>
</table>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]--></div>
</td>
</tr>
</tbody>
</table>
</center>
</body>
</html>
I am working for an emailing platform and I've been asked by a customer if we enabled Google Promotab in email designs.
I have read the documentation, tried to do a test yet I couldn't manage to display the promotion. My Gmail account is not ending with "promotabtesting#gmail" but it is configured as expected on troubleshooting section.
Are there any pre-requisits as a sender to enable the promotab feature?
I ask for both our clients (Brands) and my company that doesn't figure on "they support promotab" here : https://developers.google.com/gmail/promotab/overview but could be very soon.
Thanks a lot for your help
Max
Project Manager

Is there an expression that will return all siblings for a parent node in xslt

For each 'paymentSummaries' section, a new table will be created and
I've been able to get this to work. What isn't working is getting the
paymentSummary/splitCode/(number)(type)(policyDetails)(amountPaid) to
display (return) more than just the first instance in each table.
Here is my XML:
<paymentSummaries>
<billingAccountNumber>billingAccountNumber1</billingAccountNumber>
<paymentSummary>
<splitCode>
<number>paymentSummary1</number>
<type>type1</type>
<policyDetails>policyDetails1</policyDetails>
<amountPaid>amountPaid1</amountPaid>
</splitCode>
</paymentSummary>
<paymentSummary>
<splitCode>
<number>paymentSummary2</number>
<type>type2</type>
<policyDetails>policyDetails2</policyDetails>
<amountPaid>amountPaid2</amountPaid>
</splitCode>
</paymentSummary>
<serviceFee>serviceFee1</serviceFee>
<totalAmountPaid>totalAmountPaid1</totalAmountPaid>
</paymentSummaries>
This is what I've tried so far. The first example returns just the
first instance. The second example returns nothing/blank.
1st Example:
I have a <xsl:for-each
select="SFF/*[local-name()='paymentReceipt']/*[local-name()='paymentSummaries']">
wrapping around the entire table (this gets it to repeat the table for
each that's passed.
For the individual child and sibling elements, I haven't specified any
<for-each> or <if> tests because I thought it would just repeat the
instances.
2nd Example:
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<xsl:if test="SFF/*[local-name()='paymentReceipt']/*[local-name()='paymentSummaries']/*[local-name()='paymentSummary']/*[local-name()='splitCode'][1]/*[local-name()='number'] != ''">
<td align="left" valign="top" style="padding: 8px 5px 0px 10px;">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="170" height="25" align="left" valign="top" class="fl wrap width150">
<div class="FS13 LH18" style="font-family: Arial Narrow, Arial, Helvetica, sans-serif;font-size:14px; line-height:20px; color:#313131; font-weight:normal;">
<xsl:value-of select="SFF/*[local-name()='paymentReceipt']/*[local-name()='paymentSummaries']/*[local-name()='paymentSummary']/*[local-name()='splitCode'][1]/*[local-name()='number']"></xsl:value-of>
</div>
</td>
<td width="270" height="25" align="left" valign="top" class="fl wrap width150">
<div class="FS13 LH18" style="font-family: Arial Narrow, Arial, Helvetica, sans-serif;font-size:14px; line-height:20px; color:#313131; font-weight:normal;">
<xsl:value-of select="SFF/*[local-name()='paymentReceipt']/*[local-name()='paymentSummaries']/*[local-name()='paymentSummary']/*[local-name()='splitCode'][1]/*[local-name()='type']"></xsl:value-of>
</div>
</td>
</tr>
</table>
</td>
<td width="95" align="right" valign="top" class="width150" style="padding: 8px 5px 0px 10px;">
<div class="FS13 LH18" style="font-size:14px; line-height:20px; color:#313131; font-weight:normal;font-family: Arial Narrow, Arial, Helvetica, sans-serif;">
<xsl:value-of select="*[local-name()='paymentReceipt']/*[local-name()='paymentSummaries']/*[local-name()='paymentSummary']/*[local-name()='splitCode'][1]/*[local-name()='amountPaid']"</xsl:value-of>
</div>
</td>
</xsl:if>
</tr>
<xsl:for-each select="*[local-name()='paymentReceipt']/*[local-name()='paymentSummaries']/*[local-name()='paymentSummary']/*[local-name()='splitCode'][position() >1]">
<tr>
<td align="left" valign="top" style="padding: 8px 5px 0px 10px;">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="170" height="25" align="left" valign="top" class="fl wrap width150">
<div class="FS13 LH18" style="font-family: Arial Narrow, Arial, Helvetica, sans-serif;font-size:14px; line-height:20px; color:#313131; font-weight:normal;">
<xsl:value-of select="*[local-name()='number']"></xsl:value-of>
</div>
</td>
<td width="270" height="25" align="left" valign="top" class="fl wrap width150">
<div class="FS13 LH18" style="font-family: Arial Narrow, Arial, Helvetica, sans-serif;font-size:14px; line-height:20px; color:#313131; font-weight:normal;">
<xsl:value-of select="*[local-name()='type']"></xsl:value-of>
</div>
</td>
</tr>
</table>
</td>
<td width="95" align="right" valign="top" class="width150" style="padding: 8px 5px 0px 10px;">
<div class="FS13 LH18" style="font-size:14px; line-height:20px; color:#313131; font-weight:normal;font-family: Arial Narrow, Arial, Helvetica, sans-serif;">
<xsl:value-of select="*[local-name()='amountPaid']"></xsl:value-of>
</div>
</td>
</tr>
</xsl:for-each>
<tr bgcolor="#ffffff">
<xsl:if test="SFF/*[local-name()='paymentReceipt']/*[local-name()='paymentSummaries']/*[local-name()='paymentSummary']/*[local-name()='splitCode'][1]/*[local-name()='policyDetails'] != ''">
<td align="left" valign="top" style="padding: 0px 5px 8px 10px;">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="175" align="left" valign="top" class="fl wrap width150">
<div class="FS13 LH18" style="font-family: Arial Narrow, Arial, Helvetica, sans-serif;font-size:14px; line-height:20px; color:#313131; font-weight:normal;">
</div>
</td>
<td width="270" align="left" valign="top" class="fl wrap width150">
<div class="FS13 LH18" style="font-family: Arial Narrow, Arial, Helvetica, sans-serif;font-size:14px; line-height:20px; color:#313131; font-weight:normal;">
<xsl:value-of select="*[local-name()='splitCode'][1]/*[local-name()='policyDetails']" />
</div>
</td>
</tr>
</table>
</td>
</xsl:if>
</tr>
<table>
This is what I'm getting Table 1: paymentSummary1 type1 amountPaid1
policyDetails1 (this table is missing paymentSummary2, type2, etc.)
Table 2: paymentSummary3 type3 amountPaid3 (this table is
missing paymentSummary4, type4, etc.
policyDetails3
Any ideas how I can get this to work properly?
I think I can see what you are trying to do: put all of the payment summaries in a table followed by a single policyDetail
You start out by saying "For each 'paymentSummaries' section, a new table will be created ... "
So you want to start by doing that:
<xsl:template select='/'>
<xsl:for-each select='//paymentSummaries'>
<table>
<xsl:apply-templates select='paymentSummary'/>
<xsl:call-template name='policy'/>
</table>
</xsl:for-each>
</xsl:template>
next you ned to decide what you are going to do for each of the paymentSummary blocks. Here, I am just adding a new row to the table
<xsl:template match='paymentSummary'>
<tr>
<td>
<xsl:value-of select='splitCode/number'/>
</td>
<td>
<xsl:value-of select='splitCode/type'/>
</td>
<td>
<xsl:value-of select='splitCode/amountPaid'/>
</td>
</tr>
</xsl:template>
Finally, I add the policy part: note the call-template instead of apply-template as I only want to do this once.
<xsl:template name='policy'>
<tr>
<td>
<xsl:value-of select='paymentSummary[1]/splitCode/policyDetails'/>
</td>
</tr>
</xsl:template>
Once you have the general layout of what you want, go ahead and put in your own styling

reverse column order in zurb-ink

in desktop view I want to align the image column to the right and the text column to the left, but in mobile view the image should be on top
how can I reverse the order of the columns?
<row>
<columns small="12" large="6" class="text-container text-left small-text-center">
<h1 class="text-left">Title</h1>
<p>Copy</p>
<button href="zurb.com">Meer weten</button>
</columns>
<columns small="12" large="6" class="collapse visual-container">
<img src="assets/img/item-2.jpg" alt="" class="small-float-center float-right"/>
</columns>
</row>
Use the dir attribute.
<table class="row" dir="rtl">
<tr>
<td class="wrapper" dir="ltr">
<table class="four columns" >
<tr>
<td class="center" align="center">
<center>
<img class="center" src="http://placekitten.com/g/600/600"
width="128" height="154" alt="Majestic Kitty" />
</center>
</td>
<td class="expander"></td>
</tr>
</table>
</td>
<td class="wrapper last" dir="ltr">
<table class="eight columns">
<tr>
<td>
<p>Lorem ipsum dolor sit amet, beatae deserunt!</p>
</td>
<td class="expander"></td>
</tr>
</table>
</td>
</tr>
</table>
This shows the content left to right on desktop but the image on top on mobile.
Solution found here: http://zurb.com/university/lessons/get-your-responsive-emails-in-order

Can anyone tell me why my generated HTML is not working with this XSLT

I have the below XSLT, but when it runs, it creates the below HTML. The problem is with the two tables. The LinesFOC elements appear within the first table instead of the second table as per the XSLT.
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>Order Received</h2>
<table border="1">
<tr>
<th>Outlet</th>
<td><xsl:value-of select="Order/Outlet/Name"/></td>
</tr>
<tr>
<th>House Name / Number</th>
<td><xsl:value-of select="Order/Outlet/HouseNameNumber"/></td>
</tr>
<tr>
<th>Street Name</th>
<td><xsl:value-of select="Order/Outlet/Street1"/></td>
</tr>
<tr>
<th></th>
<td><xsl:value-of select="Order/Outlet/Street2"/></td>
</tr>
<tr>
<th></th>
<td><xsl:value-of select="Order/Outlet/Street3"/></td>
</tr>
<tr>
<th>Suburb</th>
<td><xsl:value-of select="Order/Outlet/Suburb"/></td>
</tr>
<tr>
<th>Town</th>
<td><xsl:value-of select="Order/Outlet/Town"/></td>
</tr>
<tr>
<th>County</th>
<td><xsl:value-of select="Order/Outlet/County"/></td>
</tr>
<tr>
<th>Postcode</th>
<td><xsl:value-of select="Order/Outlet/Postcode"/></td>
</tr>
<tr>
<th>Telephone Number</th>
<td><xsl:value-of select="Order/Outlet/TelephoneNumber"/></td>
</tr>
<tr>
<th>Contact Name</th>
<td><xsl:value-of select="Order/Outlet/ContactName"/></td>
</tr>
<tr>
<th>UWG Account Number</th>
<td><xsl:value-of select="Order/Outlet/UWGAccountNumber"/></td>
</tr>
<tr>
<th>Cash or Credit</th>
<td><xsl:value-of select="Order/Outlet/CashOrCredit"/></td>
</tr>
<tr>
<th>Order Date</th>
<td><xsl:value-of select="Order/Date"/></td>
</tr>
<tr bgcolor="#9acd32">
<th>Qty</th>
<th>Description</th>
</tr>
<xsl:for-each select="Order/Lines/LineItem">
<tr>
<td><xsl:value-of select="Qty"/></td>
<td><xsl:value-of select="Description"/></td>
</tr>
</xsl:for-each>
</table>
<table border="1">
<tr bgcolor="#9acd32">
<td></td>
<td>Free of Charge Items</td>
</tr>
<xsl:for-each select="Order/LinesFOC/LineItem">
<tr>
<td><xsl:value-of select="Qty"/></td>
<td><xsl:value-of select="Description"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
The generated HTML is
<table class="MsoNormalTable" border="1" cellpadding="0">
<tbody>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal" align="center" style="text-align:center"><b>Outlet </b></p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal">Test Outlet 4</p>
</td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal" align="center" style="text-align:center"><b>House Name / Number
</b></p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal">Test House</p>
</td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal" align="center" style="text-align:center"><b>Street Name </b>
</p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal">Test Street</p>
</td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt"></td>
<td style="padding:.75pt .75pt .75pt .75pt"></td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt"></td>
<td style="padding:.75pt .75pt .75pt .75pt"></td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal" align="center" style="text-align:center"><b>Suburb </b></p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal">Testtown</p>
</td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal" align="center" style="text-align:center"><b>Town </b></p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal">Testtown</p>
</td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal" align="center" style="text-align:center"><b>County </b></p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal">Cardiganshire</p>
</td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal" align="center" style="text-align:center"><b>Postcode </b></p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal">GU21 </p>
</td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal" align="center" style="text-align:center"><b>Telephone Number
</b></p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt"></td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal" align="center" style="text-align:center"><b>Contact Name </b>
</p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt"></td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal" align="center" style="text-align:center"><b>UWG Account Number
</b></p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal">55555555555</p>
</td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal" align="center" style="text-align:center"><b>Cash or Credit </b>
</p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt"></td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal" align="center" style="text-align:center"><b>Order Date </b></p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal">05/06/2013 00:00:00</p>
</td>
</tr>
<tr>
<td style="background:yellowgreen; padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal" align="center" style="text-align:center"><b>Qty</b></p>
</td>
<td style="background:yellowgreen; padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal" align="center" style="text-align:center"><b>Description</b></p>
</td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal">3</p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"> Chocolate 1L (110717)</p>
</td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal">3</p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"> Strawberry 1L (110645)</p>
</td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal">3</p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"> Banana 1L (110656)</p>
</td>
</tr>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal">3</p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"> Strawberry 1L (110645) </p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><span style=""> </span></p>
<table class="MsoNormalTable" border="1" cellpadding="0">
<tbody>
<tr>
<td style="background:yellowgreen; padding:.75pt .75pt .75pt .75pt"></td>
<td style="background:yellowgreen; padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal">Free of Charge Items </p>
</td>
</tr>
</tbody>
</table>
the last item of the first table, being:
<tr>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal">3</p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"> Strawberry 1L (110645) </p>
</td>
</tr>
should be on the second table, but for some reason, appears in the first table.
Impossible to say for sure what's going on, in the current state of the question. The two most likely causes are these.
(1) The input (which you do not show) has
<LineItem>
<Qty>3</Qty>
<Description> Strawberry 1L (110645) </Description>
</LineItem>
appearing as a child of Lines, not as a child of LinesFOC.
(2) The stylesheet which actually produced the output (which, as hr_117 and Borodin have already pointed out, you do not show) has <xsl:for-each select="Order/Lines/LineItem"> (or the equivalent) where the stylesheet you show has <xsl:for-each select="Order/LinesFOC/LineItem">.
In other words, you appear to be looking at the wrong files.

Regex to eliminate many lines of text with an known start and stop string

I am attempting to eliminate all of the text between two specific strings of text with a single regex command. The original text looks like this:
<html>
<!-- template name: text.tpl -->
<head>
<title>Cross-Collection Search</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script src="/t/text/textclass.js" language="JavaScript"></script>
<link rel="STYLESHEET" type="text/css" href="/t/text/textclass.css">
<link rel="stylesheet" href="/t/text/textclass-specific.css" type="text/css">
<script src="/t/text/bbagWindow.js" type="text/javascript" language="javascript"></script>
<script type="text/javascript" language="javascript">
<!--
window.name = "mainwindow";
//-->
</script>
</head>
<!-- -------------------------------------------------- -->
<body bgcolor="#FFFFFF" marginwidth="0" marginheight="0">
<!-- -------------------------------------------------- -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="54" class="hdrcolor" background="/t/text/graphics/hdr-bg1.gif">
<a name="top"></a>
<img src="/t/text/graphics/umdlt-smbanner.gif" border="0"></td>
<td height="54" class="hdrcolor" align="right" valign="top" background="/t/text/graphics/hdr-bg2.gif">
<table border="0" cellspacing="1" cellpadding="3">
<tr>
<td align="right" nowrap valign="top" bgcolor="#CCCCCC"> <font size="-1"><a class="globnav" href="">Authorized user login</a></font> </td>
<td align="right" bgcolor="#FFCC66" nowrap> <font size="-1"><a class="globnav" href="javascript:popupBBagWindow( 'http://ecfr.gpoaccess.gov/cgi/t/text/text-idx?c=ecfr;c=sampletc;cc=ecfr;xc=1;sid=75189253ab69c67a4a0484a5acb0c128;page=bbaglist' , true )">View
bookbag</a></font> </td>
</tr>
</table>
<font class="navinfo" size="2"><br>your bookbag has <strong>0</strong> items</font>
</td>
</tr>
<!-- BEGIN rows outlining the navigation proper -->
<!-- this row contains a table controlling layout for the top border lines of the navbar -->
<tr>
<td class="navcolor" colspan="2" align="left" height="1" nowrap>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<!-- home -->
<td width="70" height="1" align="center" nowrap><img src="/t/text/graphics/plug.gif" width="1" height="1" border="0"></td>
<td width="1"><img src="/t/text/graphics/plug.gif" width="1" height="1" border="0"></td>
<!-- search -->
<td width="90" height="1" align="center" nowrap><img src="/t/text/graphics/plug.gif" width="1" height="1" border="0"></td>
<td width="1"><img src="/t/text/graphics/plug.gif" width="1" height="1" border="0"></td>
<!-- browse -->
<td width="75" height="1" align="center" nowrap><img src="/t/text/graphics/plug.gif" width="1" height="1" border="0"></td>
<!-- blankspace -->
<td width="75" height="1" align="center" nowrap><img src="/t/text/graphics/plug.gif" width="1" height="1" border="0"></td>
<!-- help -->
<td width="75" height="1" align="center" nowrap><img src="/t/text/graphics/plug.gif" width="1" height="1" border="0"></td>
</tr></table>
</td>
</tr>
<!-- this row contains a table controlling layout for the nav tabs themselves -->
<tr>
<td class="navcolor" colspan="2" align="left" bgcolor="#666699" height="23" nowrap>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<!-- home -->
<td width="70" height="23" align="center" nowrap><font class="navlinks" color="#ffffff">Home</font></td>
<!-- search -->
<td width="90" height="23" align="center" nowrap><font class="navlinks" color="#000000">Search</font></td >
<!-- browse -->
<td width="90" height="23" align="center" nowrap><font class="navlinks" color="#ffffff">Browse</font></td >
<!-- blankspace -->
<td width="50" height="23" align="center" nowrap> </td >
<!-- help -->
<td width="70" height="23" align="center" nowrap><font class="navlinks" color="#ffffff">Help</font></td >
</tr>
</table>
</td >
</tr>
<!-- this row contains the table that controls layout for the lower nav border lines -->
<tr>
<td class="navhrcolor" colspan="2" align="left" height="1" nowrap bgcolor="#999999">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="70" height="1" align="center" nowrap><img src="/t/text/graphics/plug.gif" width="1" height="1" border="0"></td>
<td width="1"><img src="/t/text/graphics/plug.gif" width="1" height="1" border="0"></td>
<td width="90" height="1" align="center" nowrap><img src="/t/text/graphics/plug.gif" width="1" height="1" border="0"></td>
<td width="1"><img src="/t/text/graphics/plug.gif" width="1" height="1" border="0"></td>
<td width="75" height="1" align="center" nowrap><img src="/t/text/graphics/plug.gif" width="1" height="1" border="0"></td>
<td width="75" height="1" align="center" nowrap><img src="/t/text/graphics/plug.gif" width="1" height="1" border="0"></td>
</tr></table>
</td>
</tr>
</table>
<table cellspacing="0" cellpadding="5" width="100%">
<tr>
<td valign="top" nowrap>
<hr size="1">
</td>
</tr>
</table>
<table cellspacing="0" cellpadding="15">
<tr>
<td>
<br>
<strong><span class=mainheader>
The completed text after a regex search and replace needs to look like this:
<html>
<strong><span class="mainheader">
For some reason, just using the following does not work. Why?
<html>(.*)<strong><span class=mainheader>
You probably need dot-all mode on (to make . matches new line character), or just replace . with [\s\S] (which ensures that all characters are matched regardless of whether your language support dot-all mode or not).