简体   繁体   English

在Siebel中使用XSL和XSLT1.0转换HTML?

[英]Transform a HTML using XSL with XSLT1.0 in Siebel?

I have a HTML like this below. 我下面有一个这样的HTML。 I need to use XSLT 1.0 and remove the elements below a certain element in the following HTML based on the attribute value of a child element in one of the elements. 我需要使用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:&quot;Calibri&quot;,sans-serif">This is the document for ER Overview<o:p/> </span> </p> <p class="MsoNormal"> <span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif">Test 1 <o:p/> </span> </p> <p class="MsoNormal"> <span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif">2<o:p/> </span> </p> <p class="MsoNormal"> <span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;background:yellow;mso-highlight:yellow">3</span> <span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif"> <o:p/> </span> </p> <p class="MsoNormal"> <span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif">4<o:p/> </span> </p> <p class="MsoNormal"> <span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;background:lime;mso-highlight:lime">5</span> <span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif"> <o:p/> </span> </p> <p class="MsoNormal"> <a name="_MailEndCompose"> <span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif"> <o:p>&nbsp;</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:&quot;Calibri&quot;,sans-serif">From:</span> </b> <span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif"> AutoReply [mailto:reply@support.com]<br> <b>Sent:</b> Thursday, March 2, 2017 6:50 PM<br> <b>To:</b> Doe, John &lt;johndoe@support.com&gt;<br> <b>Subject:</b> This is a test for routing rules<o:p/> </span> </p> </div> </div> <p class="MsoNormal"> <o:p>&nbsp;</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:&quot;Calibri&quot;,sans-serif">Test 1</span> <o:p/> </p><p class="MsoNormal"> <span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif">2</span> <o:p/> </p><p class="MsoNormal"> <span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;background:yellow;mso-highlight:yellow">3</span> <o:p/> </p><p class="MsoNormal"> <span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif">4</span> <o:p/> </p><p class="MsoNormal"> <span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;background:lime;mso-highlight:lime">5</span> <o:p/> </p><p class="MsoNormal"> <span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif">&nbsp;</span> <o:p/> </p> <div> <div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in"> <p class="MsoNormal">&lt;a name=&quot;<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>&nbsp;</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:&quot;Arial&quot;,sans-serif;color:black"> <br>Confidentiality Notice.<br> </p> </div> </body> </html> 

I need to remove all the elements below the <p> tag that has the <a name="_MailEndCompose"> child. 我需要删除<p>标记下具有<a name="_MailEndCompose">子代的所有元素。 The output should be like the below HTML. 输出应类似于以下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:&quot;Calibri&quot;,sans-serif">This is the document for ER Overview<o:p/> </span> </p> <p class="MsoNormal"> <span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif">Test 1 <o:p/> </span> </p> <p class="MsoNormal"> <span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif">2<o:p/> </span> </p> <p class="MsoNormal"> <span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;background:yellow;mso-highlight:yellow">3</span> <span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif"> <o:p/> </span> </p> <p class="MsoNormal"> <span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif">4<o:p/> </span> </p> <p class="MsoNormal"> <span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;background:lime;mso-highlight:lime">5</span> <span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif"> <o:p/> </span> </p> <p class="MsoNormal"> <a name="_MailEndCompose"> <span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif"> <o:p>&nbsp;</o:p> </span> </a> </p> </div> </body> </html> 

Really appreciate your help Gurus. 非常感谢您对Gurus的帮助。 Thank you all. 谢谢你们。

I'm not a Siebel programming, but these two templates might help you. 我不是Siebel编程人员,但是这两个模板可能会对您有所帮助。 They would work for Microsoft's 1.0 XSLT. 它们将适用于Microsoft的1.0 XSLT。 Maybe you can leverage. 也许您可以利用。

<!-- 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']]]"/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM