我在下面有一个类似的html。我需要使用XSLT 1.0并根据一个元素中子元素的属性值在以下HTML中删除以下元素以下的元素。
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body lang="EN-US">
<div class="WordSection1">
<p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri",sans-serif">This is the document for ER Overview<o:p/>
</span>
</p>
<p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Test 1 <o:p/>
</span>
</p> <p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri",sans-serif">2<o:p/>
</span>
</p> <p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri",sans-serif;background:yellow;mso-highlight:yellow">3</span>
<span style="font-size:11.0pt;font-family:"Calibri",sans-serif">
<o:p/>
</span>
</p> <p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri",sans-serif">4<o:p/>
</span>
</p> <p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri",sans-serif;background:lime;mso-highlight:lime">5</span>
<span style="font-size:11.0pt;font-family:"Calibri",sans-serif">
<o:p/>
</span>
</p>
<p class="MsoNormal">
<a name="_MailEndCompose">
<span style="font-size:11.0pt;font-family:"Calibri",sans-serif">
<o:p> </o:p>
</span>
</a>
</p>
<span style="mso-bookmark:_MailEndCompose"/>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal">
<a name="_____replyseparator"/>
<b>
<span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span>
</b>
<span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> AutoReply [mailto:reply@support.com]<br>
<b>Sent:</b> Thursday, March 2, 2017 6:50 PM<br>
<b>To:</b> Doe, John <johndoe@support.com><br>
<b>Subject:</b> This is a test for routing rules<o:p/>
</span>
</p>
</div>
</div>
<p class="MsoNormal">
<o:p> </o:p>
</p>
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="500" style="width:375.0pt">
<tbody>
<tr>
<td style="padding:0in 0in 0in 0in">
<p class="MsoNormal">The contents of the note are included below.<br>
<br>If reply includes an attachment/image, please go Transaction Center to view the file.<br>
<br>To add a Note, simply reply to the email.<br>Please do not edit the email subject.<br>
<br>The following note was posted by <a href="mailto:johndoe@support.com">johndoe@support.com</a>:<o:p/>
</p>
</td>
</tr>
<tr>
<td style="padding:0in 0in 0in 0in">
<p class="MsoNormal">_______________________________________________________________________<br>
<br>
<o:p/>
</p><p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Test 1</span>
<o:p/>
</p><p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri",sans-serif">2</span>
<o:p/>
</p><p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri",sans-serif;background:yellow;mso-highlight:yellow">3</span>
<o:p/>
</p><p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri",sans-serif">4</span>
<o:p/>
</p><p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri",sans-serif;background:lime;mso-highlight:lime">5</span>
<o:p/>
</p><p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> </span>
<o:p/>
</p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><a name="<o:p/>
</p>
</div><p class="MsoNormal">
<br>_______________________________________________________________________<o:p/>
</p>
</div>
</td>
</tr>
<tr>
<td style="padding:0in 0in 0in 0in">
<p class="MsoNormal">Technical Support.<br>
<br>
<br>****************** Internal Use Only ******************<br>To view this request in the CIS View, use the following URL:<br>
</p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal">
<o:p> </o:p>
</p>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="3" width="100%" align="center">
</div>
<p class="MsoNormal">
<span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:black">
<br>Confidentiality Notice.<br>
</p>
</div>
</body>
</html>
我需要删除带有<a name="_MailEndCompose">
子的<p>
标签下方的所有元素。输出应像以下HTML。
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body lang="EN-US">
<div class="WordSection1">
<p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri",sans-serif">This is the document for ER Overview<o:p/>
</span>
</p>
<p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Test 1 <o:p/>
</span>
</p> <p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri",sans-serif">2<o:p/>
</span>
</p> <p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri",sans-serif;background:yellow;mso-highlight:yellow">3</span>
<span style="font-size:11.0pt;font-family:"Calibri",sans-serif">
<o:p/>
</span>
</p> <p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri",sans-serif">4<o:p/>
</span>
</p> <p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri",sans-serif;background:lime;mso-highlight:lime">5</span>
<span style="font-size:11.0pt;font-family:"Calibri",sans-serif">
<o:p/>
</span>
</p>
<p class="MsoNormal">
<a name="_MailEndCompose">
<span style="font-size:11.0pt;font-family:"Calibri",sans-serif">
<o:p> </o:p>
</span>
</a>
</p>
</div>
</body>
</html>
非常感谢您的帮助大师。谢谢大家。
我不是Siebel编程,但是这两个模板可能会为您提供帮助。他们将为微软1.0 XSLT工作。也许您可以利用。
<!-- Identity template -->
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<!-- Suppress everything after the mail end compose. -->
<xsl:template match="*[preceding::p[.//a[@name='_MailEndCompose']]]"/>