如何将xsl嵌入xml以在web浏览器中查看

如何将xsl嵌入xml以在web浏览器中查看,xml,xslt,Xml,Xslt,我收到了以下代码,需要对其进行一些更改,但首先我希望能够在浏览器中查看结果。 我在这方面是新手,还不了解嵌入xsl的结构 我确实尝试了其他几个“如何嵌入xsl”问题的解决方案,但没有效果 是否有人可以告诉我需要更改哪些内容才能使其生效,以便在浏览器中查看: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:param name="stateme

我收到了以下代码,需要对其进行一些更改,但首先我希望能够在浏览器中查看结果。 我在这方面是新手,还不了解嵌入xsl的结构

我确实尝试了其他几个“如何嵌入xsl”问题的解决方案,但没有效果

是否有人可以告诉我需要更改哪些内容才能使其生效,以便在浏览器中查看:

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:param name="statementTitle"/>
    <xsl:param name="customLogoURL"/>
    <xsl:param name="companyLogoURLParam"/>
    <xsl:param name="companyName"/>
    <xsl:param name="DEPARTMENT"/>
    <xsl:param name="moneyFormat"/>
    <xsl:param name="amountFormat"/>
    <xsl:param name="percentFormat"/>
    <xsl:param name="userLocaleSpecificMoneyFormat"/>
    <xsl:param name="userLocaleSpecificAmountFormat"/>
    <xsl:param name="userLocaleSpecificPercentFormat"/>
    <xsl:param name="userLocaleSpecificBonusPercentFormat"/>
    <xsl:param name="userLocaleSpecificDecimalFormatter"/>
    <xsl:param name="EMPID"/>
    <xsl:param name="FIRSTNAME"/>
    <xsl:param name="LASTNAME"/>
    <xsl:param name="DIVISION"/>
    <xsl:param name="LOCATION"/>
    <xsl:param name="TITLE"/>
    <xsl:decimal-format name="defaultDecimalFormatter" grouping-separator="," decimal-separator="."/>
    <xsl:decimal-format name="decimalFormatterDotComma" grouping-separator="." decimal-separator=","/>
    <xsl:decimal-format name="decimalFormatterSpaceComma" grouping-separator=" " decimal-separator=","/>
    <xsl:variable name="companyLogoURL" select="$companyLogoURLParam"/>
    <xsl:template match="/sf-compensation">
        <!--Variable Defnitions go here-->
        <xsl:variable name="empFirstName" select="./comp-plan-entry/comp-plan-entry-firstname"/>
        <xsl:variable name="empLastName" select="./comp-plan-entry/comp-plan-entry-lastname"/>
        <xsl:variable name="userId" select="./comp-plan-entry/comp-plan-entry-userid"/>
        <xsl:variable name="salaryEligible" select="./comp-plan-entry/comp-salary/comp-salary-ineligible"/>
        <xsl:variable name="promoEligible" select="./comp-plan-entry/comp-salary/comp-salary-ineligible/@promo-ineligible"/>
        <xsl:variable name="meritEligible" select="./comp-plan-entry/comp-salary/comp-salary-ineligible/@merit-ineligible"/>
        <xsl:variable name="extraEligible" select="./comp-plan-entry/comp-salary/comp-salary-ineligible/@extra-ineligible"/>
        <xsl:variable name="extra2Eligible" select="./comp-plan-entry/comp-salary/comp-salary-ineligible/@extra2-ineligible"/>
        <xsl:variable name="lumpsumEligible" select="./comp-plan-entry/comp-salary/comp-salary-ineligible/@lumpsum-ineligible"/>
        <xsl:variable name="lumpsum2Eligible" select="./comp-plan-entry/comp-salary/comp-salary-ineligible/@lumpsum2-ineligible"/>
        <xsl:variable name="bonusEligible" select="./comp-plan-entry/comp-bonus/comp-bonus-ineligible"/>
        <xsl:variable name="stockEligible" select="./comp-plan-entry/comp-stock/comp-stock-ineligible"/>
        <xsl:variable name="stockUnitsEligible" select="./comp-plan-entry/comp-stock/comp-stock-ineligible/@units-ineligible"/>
        <xsl:variable name="stockOptionEligible" select="./comp-plan-entry/comp-stock/comp-stock-ineligible/@option-ineligible"/>
        <xsl:variable name="stockStockEligible" select="./comp-plan-entry/comp-stock/comp-stock-ineligible/@stock-ineligible"/>
        <xsl:variable name="stockOther1Eligible" select="./comp-plan-entry/comp-stock/comp-stock-ineligible/@other1-ineligible"/>
        <xsl:variable name="stockOther2Eligible" select="./comp-plan-entry/comp-stock/comp-stock-ineligible/@other2-ineligible"/>
        <xsl:variable name="stockOther3Eligible" select="./comp-plan-entry/comp-stock/comp-stock-ineligible/@other3-ineligible"/>
        <xsl:variable name="cust_current_annual_actual_salary" select="./comp-plan-entry/comp-custom-data/comp-custom-field[@id='cust_current_annual_actual_salary']"/>
        <xsl:variable name="merit" select="./comp-plan-entry/comp-salary/comp-salary-merit"/>
        <xsl:variable name="cust_total_pct_increase" select="./comp-plan-entry/comp-custom-data/comp-custom-field[@id='cust_total_pct_increase']"/>
        <xsl:variable name="cust_final_annual_actual_salary" select="./comp-plan-entry/comp-custom-data/comp-custom-field[@id='cust_final_annual_actual_salary']"/>
        <html>
            <head>
                <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"/>
                <title>Letter</title>
                <link href="/css/profed/styles.css" media="screen" type="text/css" rel="stylesheet"/>
                <link href="/css/profed/print.css" media="print" type="text/css" rel="stylesheet"/>
                <style>.hide-textSection{display:none;}.chart-table td.right{white-space: nowrap;} </style>
            </head>
            <body class="statement">
                <!-- begin of text content -->
                <div id="statementContainer">
                    <table id="content" width="100%">
                        <tr>
                            <td>
                                <img alt="Success Factors" src="{$companyLogoURL}"/>
                            </td>
                            <td/>
                        </tr>
                        <tr>
                            <td colspan="3">
                                <div class="spacerPadding2"/>
                                <div class="spacerPadding2"/>
                            </td>
                        </tr>
                        <tr>
                            <td class="borderBottom1" colspan="3">
                                <xsl:text disable-output-escaping="yes">
                                    <![CDATA[Private and Confidential<div>[First Name] [[Last Name]</div><div>[Email Address]</div><div><br></div><div><br></div><div><br></div>]]>
                                </xsl:text>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="3">
                                <div class="spacerPadding2"/>
                                <div class="spacerPadding2"/>
                            </td>
                        </tr>
                        <tr>
                            <td width="400" valign="top">
                                <div id="statement">
                                    <xsl:text disable-output-escaping="yes">
                                        <![CDATA[Dear ]]>
                                    </xsl:text>
                                    <xsl:value-of select="$empFirstName"/>
                                    <xsl:text disable-output-escaping="yes">
                                        <![CDATA[,

        <p>I am writing to confirm that, with effect from 1 June 2020, your gross annual salary will increase to the amount shown.&nbsp; All other terms and conditions of employment remain unchanged.</p><p>I would like to take this opportunity to thank you for your hard work and commitment to SomeCompany and I look forward to working with you over the coming year.</p><p><br></p><p>Yours sincerely</p><p>SomeCompany</p>]]>
                                    </xsl:text>
                                </div>
                                <div id="textSection"></div>
                            </td>
                            <td width="50"/>
                            <td valign="top">
                                <xsl:if test="$salaryEligible = 'false'">
                                    <table class="chart-table" width="200" cellspacing="0">
                                        <tr>
                                            <th colspan="2" style="border-top: 1px solid #ccc;border-bottom: 1px solid #ccc;padding: .5em;text-align: center;font-weight: bold;font-size: 11px;">
                                                <![CDATA[Salary Review 2020]]>
                                            </th>
                                        </tr>
                                        <tr>
                                            <td>
                                                <![CDATA[Current Gross Annual Salary]]>
                                            </td>
                                            <td class="right" valign="top">
                                                <xsl:value-of select="format-number($cust_current_annual_actual_salary, $userLocaleSpecificMoneyFormat, $userLocaleSpecificDecimalFormatter)"/>
                                            </td>
                                        </tr>
                                        <xsl:if test="$merit > 0">
                                            <tr>
                                                <td>
                                                    <![CDATA[Salary Review Amount]]>
                                                </td>
                                                <td class="right" valign="top">
                                                    <xsl:value-of select="format-number($merit, $userLocaleSpecificMoneyFormat, $userLocaleSpecificDecimalFormatter)"/>
                                                </td>
                                            </tr>
                                        </xsl:if>
                                        <tr>
                                            <td>
                                                <![CDATA[Salary Review %]]>
                                            </td>
                                            <td class="right" valign="top">
                                                <xsl:value-of select="format-number($cust_total_pct_increase, $userLocaleSpecificPercentFormat, $userLocaleSpecificDecimalFormatter)"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <![CDATA[Final Gross Annual Salary]]>
                                            </td>
                                            <td class="right" valign="top">
                                                <xsl:value-of select="format-number($cust_final_annual_actual_salary, $userLocaleSpecificMoneyFormat, $userLocaleSpecificDecimalFormatter)"/>
                                            </td>
                                        </tr>
                                    </table>
                                </xsl:if>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="3">
                                <div id="signature">
                                    <xsl:text disable-output-escaping="yes">
                                        <![CDATA[<div>[Signature Image]</div><div><br></div><div><br></div>John Doe<div>Manager</div><div><br></div><div>johndoe@somecompany.it</div><div>Tel. 123456789</div><div><br></div><div><br></div><div><br></div><div><div><br></div><div><br></div><div>[Footer in Blue]</div><div>Some Company</div><div>Registered address: some address</div></div>]]>
                                    </xsl:text>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>
                <!-- end of text content -->
            </body>
        </html>
    </xsl:template>
</xsl:stylesheet>

书信
.hide textSection{display:none;}.chart table td.right{空白:nowrap;}
[名字][[姓氏][电子邮件地址]


] 我写信确认,自2020年6月1日起,您的总年薪将增加至所示金额。所有其他雇佣条款和条件保持不变。

我想借此机会感谢您对某家公司的辛勤工作和承诺,我期待着在未来一年与您共事。


您诚挚的

某家公司

]> [签名图像]

John DoeManager
johndoe@somecompany.itTel. 123456789




[蓝色页脚]某些公司注册地址:某些地址]]>
不幸的是,它使用了禁用输出转义,因为这是XSLT的一个可选(且已弃用)功能,不能在所有浏览器中使用。但除此之外,只需在xml的开头添加一条xml样式表处理指令,就可以让它运行。您尝试了什么,它是如何失败的?@MichaelKay所以假设我的文件名为test.xsl,我会在顶部添加类似的内容?然而,这并没有达到预期的效果。也就是说,页面呈现为带有标记和all的文本。这可能有各种各样的原因。最常见的是(a)XML文档使用错误的媒体类型发送,(b)XML文档来自filestore rath