提问人:wp1928 提问时间:9/29/2023 最后编辑:CausingUnderflowsEverywherewp1928 更新时间:9/30/2023 访问量:42
HTML 代码在尝试验证时获取列的错误消息
HTML Code Gets Error Message for Columns Upon Validation Attempt
问:
我完全不明白为什么我的代码无法验证。每次尝试时,我都会收到以下错误:“模板中的第 257 行第 5 列错误。 细节......”
下面代码中的第 257 行是“ </#list>” - 没有“列”。那么为什么说“列”有问题,我该如何解决呢?
这是我们的代码:
<?xml version="1.0"?><!DOCTYPE pdf PUBLIC "-//big.faceless.org//report" "report-1.1.dtd">
<pdf>
<head>
<link name="NotoSans" type="font" subtype="truetype" src="${nsfont.NotoSans_Regular}" src-bold="${nsfont.NotoSans_Bold}" src-italic="${nsfont.NotoSans_Italic}" src-bolditalic="${nsfont.NotoSans_BoldItalic}" bytes="2" />
<#if .locale == "zh_CN">
<link name="NotoSansCJKsc" type="font" subtype="opentype" src="${nsfont.NotoSansCJKsc_Regular}" src-bold="${nsfont.NotoSansCJKsc_Bold}" bytes="2" />
<#elseif .locale == "zh_TW">
<link name="NotoSansCJKtc" type="font" subtype="opentype" src="${nsfont.NotoSansCJKtc_Regular}" src-bold="${nsfont.NotoSansCJKtc_Bold}" bytes="2" />
<#elseif .locale == "ja_JP">
<link name="NotoSansCJKjp" type="font" subtype="opentype" src="${nsfont.NotoSansCJKjp_Regular}" src-bold="${nsfont.NotoSansCJKjp_Bold}" bytes="2" />
<#elseif .locale == "ko_KR">
<link name="NotoSansCJKkr" type="font" subtype="opentype" src="${nsfont.NotoSansCJKkr_Regular}" src-bold="${nsfont.NotoSansCJKkr_Bold}" bytes="2" />
<#elseif .locale == "th_TH">
<link name="NotoSansThai" type="font" subtype="opentype" src="${nsfont.NotoSansThai_Regular}" src-bold="${nsfont.NotoSansThai_Bold}" bytes="2" />
</#if>
<macrolist>
`your text`
<macro id="nlheader">
<table class="header" style="width: 100%;">
<tr>
<td rowspan="9">
<#if companyInformation.logoUrl?length != 0><img src="${companyInformation.logoUrl}" style="float: left; margin: 7px; height: 80%; width: 80%" /> </#if>
<p>
<barcode codetype="code128" showtext="true" value="${record.tranid}"/>
</p>
</td>
<td style="width: 308px;"><span class="title" style="font-size: 20pt;"> <strong>PICKING TICKET</strong></span></td>
</tr>
<tr>
<td align="Left" style="width: 308px;"><span class="number"><strong>Order #:</strong> #${record.tranid}</span></td>
</tr>
<tr>
<td align="Left" style="font-size: 9pt; width: 308px; margin-top: 10px;"><strong>Order Date: </strong> ${record.trandate}<br /><strong>Customer #:</strong> ${record.custbody7}<br /><strong>PO #:</strong> ${record.otherrefnum}<br /><strong>Sales Rep:</strong> ${record.salesrep}<br /><strong>Terms: </strong> ${record.terms}<br /><strong>Pmt Method:</strong> ${record.paymentmethod}<br /><strong>Delivery Phone:</strong> ${record.custbody10}</td>
</tr>
</table>
</macro>
<macro id="nlfooter">
<table class="footer" style="width: 100%;">
<tr>
<td align="center" style="width: 500px;">
<pagenumber/>
of
<totalpages/>
</td>
<td align="right" style="font-size:4px; width: 50px;">WP Picking Ticket ADV</td>
</tr>
</table>
</macro>
</macrolist>
<style type="text/css">* {
<#if .locale == "zh_CN">
font-family: NotoSans, NotoSansCJKsc, sans-serif;
<#elseif .locale == "zh_TW">
font-family: NotoSans, NotoSansCJKtc, sans-serif;
<#elseif .locale == "ja_JP">
font-family: NotoSans, NotoSansCJKjp, sans-serif;
<#elseif .locale == "ko_KR">
font-family: NotoSans, NotoSansCJKkr, sans-serif;
<#elseif .locale == "th_TH">
font-family: NotoSans, NotoSansThai, sans-serif;
<#else>
font-family: NotoSans, sans-serif;
</#if>
}
table {
font-size: 9pt;
table-layout: fixed;
}
th {
font-weight: bold;
font-size: 9pt;
vertical-align: middle;
padding: 5px 6px 3px;
background-color: #d8d8d8;
color: #333333;
}
td {
padding: 4px 6px;
}
td p { align:left }
b {
font-weight: bold;
color: #333333;
}
table.header td {
padding: 0;
font-size: 10pt;
}
table.footer td {
padding: 0;
font-size: 8pt;
}
table.itemtable th {
padding-bottom: 10px;
padding-top: 10px;
}
table.body td {
padding-top: 2px;
}
td.addressheader {
font-size: 8pt;
font-weight: bold;
padding-top: 6px;
padding-bottom: 2px;
}
td.address {
padding-top: 0;
}
span.title {
font-size: 28pt;
}
span.number {
font-size: 16pt;
}
span.itemname {
font-weight: bold;
line-height: 150%;
}
hr {
width: 100%;
color: #d3d3d3;
background-color: #d3d3d3;
height: 1px;
}
</style>
</head>
<body header="nlheader" header-height="16%" footer="nlfooter" footer-height="20pt" padding="0.5in 0.5in 0.5in 0.5in" size="Letter">
<table style="width: 100%; margin-top: 10px;">
<tr>
<td class="addressheader" style="font-size: 12pt;"><b>${record.billaddress@label}</b></td>
<td class="addressheader" style="font-size: 12pt;"><b>${record.shipaddress@label}</b></td>
</tr>
<tr>
<td class="address" style="font-size: 10pt;">${record.billaddress}</td>
<td class="address" style="font-size: 10pt;">${record.shipaddress}</td>
</tr>
</table>
<table class="body" style="width: 100%; margin-top: 10px;">
<tr>
<th colspan="2">Ship Via</th>
<th>Shipper #</th>
<th>Ship Date</th>
</tr>
<tr>
<td colspan="2">${record.shipmethod}</td>
<!-- *************************************Shipping account logic below**********************************************************************--><#if record.shipmethod?contains ("Bill Receiver")><#if record.shipmethod?contains ("UPS")>
<td>UPS: ${record.custbody14}</td>
<#else>
<td>Fedex: ${record.custbody15}</td>
</#if><#elseif record.shipmethod?contains ("3rd Party")><#if record.shipmethod?contains ("UPS")>
<td>UPS: ${record.custbody14}</td>
<#else>
<td>Fedex: ${record.custbody15}</td>
</#if><#elseif record.shipmethod?contains ("Collect")><#if record.shipmethod?contains ("UPS")>
<td>UPS: ${record.custbody14}</td>
<#else>
<td>Fedex: ${record.custbody15}</td>
</#if><#else>
<td> </td>
</#if>
<td>${record.shipdate}</td>
</tr>
</table>
<table class="body" style="width: 100%; margin-top: 10px;">
<tr>
<th>Note to WP Warehouse</th>
</tr>
<tr>
<td>${record.Custbody18}</td>
</tr>
</table>
<!-- *************************************Item table below**********************************************************************--><#if record.item?has_content>
<table class="itemtable" style="width: 100%; margin-top: 10px;">
<!-- start items -->
<#list record.item as item>
<#if item_index==0>
<thead>
<tr>
<th colspan="4">${item.item@label}</th>
<th>Shelf</th>
<th>Ordered</th>
<th>To Ship</th>
<th>B/O</th>
<th>Shipped</th>
</tr>
</thead>
</#if>
<#if (item.quantitycommitted?string == '0')>
<#elseif item.itemtype == 'OthCharge'><!-- If none comitted or itemtype is other charge then print nothing, else print whats below-->
<#else>
<tr>
<td colspan="4"><span class="itemname">${item.item}</span><br />${item.description}</td>
<td>${item.custcol2}</td>
<td>${item.quantity}</td>
<td>${item.quantitycommitted}</td>
<td>${item.quantitybackordered}</td>
<td>_____</td>
</tr>
<!-- </#if> -->
</#list>
</table>
<!-- *************************************Items BackOrdered**********************************************************************-->
<hr />
<table class="itemtable" style="width:100%; margin-top:20px;">
<tr>
<td align="left" style="font-size:13pt;"><strong>BACKORDERED ITEM(S):</strong></td>
</tr>
<tr>
<td align="left" style="font-size:8pt;"><em>Excludes partial backorder items.</em></td>
</tr>
</table>
<table class="itemtable2" style="width: 100%; margin-top: 0px;">
<thead>
<tr>
<th colspan="12">Item</th>
<!-- <th colspan="3">${salesorder.item[0].options@label}</th> -->
<th align="right" colspan="4">${salesorder.item[0].quantityordered@label}</th>
<th align="right" colspan="4">Shipped</th>
<th align="right" colspan="4">${salesorder.item[0].quantityremaining@label}</th>
<th align="right" colspan="4">Unit</th>
</tr>
</thead>
<#list salesorder.item as tranline>
<#if tranline.quantityremaining?has_content && tranline.quantity?string = ''>
<tr>
<td colspan="12"><span class="itemname">${tranline.item}</span><br />${tranline.description}</td>
<!-- <td colspan="3">${tranline.options}</td> -->
<td align="right" colspan="4">${tranline.quantityordered}</td>
<td align="right" colspan="4">${tranline.quantity}</td>
<td align="right" colspan="4">${tranline.quantityremaining}</td>
<td align="right" colspan="4">${tranline.custcol5}</td>
</tr>
</#if>
</#list>
</table>
<!--********************************************************************End Item Lists*******************************************************--><!--********************************************************************End Item Lists*******************************************************-->
</#if>
<#if preferences.RETURNFORM && returnForm??>
<hr />
<div class="returnform" visibility="hidden">
<table style="width: 100%; margin-top: 10px;">
<tr>
<td><span class="nameandaddress">${companyInformation.companyName}</span></td>
<td align="right"><span class="number">${returnForm@title}</span></td>
</tr>
</table>
<table style="width: 100%; margin-top: 10px;" visibility="hidden">
<tr>
<td class="addressheader" colspan="4">${returnForm.returnAddress}</td>
<th>${returnForm.rmaNum}</th>
<th colspan="2">${returnForm.customerName}</th>
<th>${salesorder.tranid@label}</th>
</tr>
<tr>
<td class="address" colspan="4" rowspan="2"> </td>
<td> </td>
<td colspan="2">${salesorder.entity}</td>
<td>${salesorder.tranid}</td>
</tr>
<tr>
<td colspan="4"> </td>
</tr>
</table>
<table class="itemtable" style="width: 100%; margin-top: 10px;" visibility="hidden">
<thead>
<tr>
<th colspan="2">${returnForm.item}</th>
<th colspan="1">${returnForm.quantity}</th>
<th colspan="5">${returnForm.reason}</th>
</tr>
</thead>
<tr>
<td colspan="8"> </td>
</tr>
</table>
</div>
</#if>
</#list>
</table>
</#if>
</#if>
</#elseif>
</#if>
</#if>
</tr>
</table>
</body>
</#elseif>
</#elseif>
</#if>
</head>
</pdf>
答:
0赞
CausingUnderflowsEverywhere
9/30/2023
#1
首先,相应地格式化缩进
你的缩进到处都是。如果您无法从一瞥中分辨出一个标签的开始和结束位置,您将如何直观地验证每个开始标签是否具有结束标签?
官方代码:
<!-- start items -->
<#list record.item as item>
<#if item_index==0>
<thead>
<tr>
<th colspan="4">${item.item@label}</th>
<th>Shelf</th>
<th>Ordered</th>
<th>To Ship</th>
<th>B/O</th>
<th>Shipped</th>
</tr>
</thead>
</#if>
<#if (item.quantitycommitted?string == '0')>
<#elseif item.itemtype == 'OthCharge'><!-- If none comitted or itemtype is other charge then print nothing, else print whats below-->
<#else>
<tr>
<td colspan="4"><span class="itemname">${item.item}</span><br />${item.description}</td>
<td>${item.custcol2}</td>
<td>${item.quantity}</td>
<td>${item.quantitycommitted}</td>
<td>${item.quantitybackordered}</td>
<td>_____</td>
</tr>
<!-- </#if> -->
</#list>
缩 进:
<!-- start items -->
<#list record.item as item>
<#if item_index==0>
<thead>
<tr>
<th colspan="4">${item.item@label}</th>
<th>Shelf</th>
<th>Ordered</th>
<th>To Ship</th>
<th>B/O</th>
<th>Shipped</th>
</tr>
</thead>
</#if>
<#if (item.quantitycommitted?string == '0')>
<#elseif item.itemtype == 'OthCharge'><!-- If none comitted or itemtype is other charge then print nothing, else print whats below-->
<#else>
<tr>
<td colspan="4"><span class="itemname">${item.item}</span><br />${item.description}</td>
<td>${item.custcol2}</td>
<td>${item.quantity}</td>
<td>${item.quantitycommitted}</td>
<td>${item.quantitybackordered}</td>
<td>_____</td>
</tr>
<!-- </#if> -->
</#list>
缩进将允许您验证您拥有所有开始和结束标签,并且没有什么是超然的。
解决方案:我将大胆猜测,并说您需要取消注释 if 语句的结束标记。
</tr>
</#if>
</#list>
评论
0赞
wp1928
10/28/2023
感谢@CausingUnderflowsEverywhere的建议和帮助。我已经更正了缩进,但现在我得到的错误说它在第 278 行第 7 列。我不明白。一切看起来都很好,它显示为绿色文本。第 278 行第 7 列为 </#list>。因此,如果我尝试删除 </#list>,那么我会得到另一个错误,说第 279 行,第 7 列是错误,它周围的一堆文本变成红色。你还有其他建议吗?
0赞
wp1928
10/28/2023
没关系!我让它工作了!
评论