Как встроить xsl в xml для просмотра в веб-браузере - PullRequest
0 голосов
/ 17 февраля 2020

Мне дали следующий код, и мне нужно внести в него некоторые изменения, но сначала я бы хотел увидеть результат в браузере. Я новичок в этом и пока не понимаю структуру встраивания 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>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...