为什么我的XSL文件不再应用于我的XML文件?

时间:2019-07-16 20:17:17

标签: xml xslt

我在.. \ reports目录中创建xml文件,它们引用样式表,例如:'。\ SurveyRespondentList.xsl'

最新的Firefox Quantum 68.0(64位)不接受。
以前的版本已经使用了多年了
我的报告也可以在Internet Explorer 11上使用
我的应用程序向所有人开放,多年来我一直使用这种方法来创建和显示数据库查询报告。

所有报告文件都是file:// URL,这些URL是由我为在本地PC上使用而创建的程序在本地PC上为用户创建的。目的是他们可以在大多数任何Web浏览器中查看其报告。 这种方法已经运行了好几年(〜十年)。

我问Mozilla / Firefox:

  1. 我使用多年的简单功能会永远消失吗?还是将来会最终修复一些补丁?
  

“开发人员意识到,此修补程序在基于HTML的帮助文档中造成了问题,但是他们无法提出一种方法来区分合法的本地链接和潜在的攻击链接。将来,他们可能会提出可以使帮助文档再次运行的工具,希望您可以从中受益,但是这种情况不太可能很快发生。”

网络浏览器的趋势是什么?
有人知道另一种方法吗?
例如:是否有合理的方法将xslt / css嵌入.xml数据文件中?

<?xml version='1.0' encoding='UTF-8'?>
<?xml-stylesheet type='text/xsl' href='.\MealTimeFoodListReportLIKE.xsl'?>
<dataroot generated='2019-06-14T12:10:19'>
    <ReportTitle>MealTime Food List Report LIKE</ReportTitle>
    <ReportDate>2019-06-14  12:10:19</ReportDate>

    <reportdatetime>14 Jun 2019 12:10:19</reportdatetime>

    <qrMealTimeFoodListReportLIKE>
        <MealTime>3/28/2018 2:06:52 PM</MealTime>
        <Food>ChocolateMousse - Chocolate Mousse - </Food>
    </qrMealTimeFoodListReportLIKE>

    <qrMealTimeFoodListReportLIKE>
        <MealTime>5/18/2018 11:45:53 AM</MealTime>
        <Food>ChocolateMousse - Chocolate Mousse - </Food>
    </qrMealTimeFoodListReportLIKE>
</dataroot>

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:fx="#fx-functions" exclude-result-prefixes="msxsl fx">
    <xsl:output method="html" version="4.0" indent="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
    <xsl:template match="//dataroot" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <html>
            <head>
                <META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=UTF-8"/>
                <title>MealTimeFoodListReportLIKE</title>
                <style type="text/css">
                body
                {
                    background-color:white;
                    color:black;
                    font-family:arial;
                    font-selection-strategy:auto;
                    font-size:9pt;
                    font-stretch:normal;
                    font-size-adjust:none;
                    font-style:normal;
                    font-variant:normal;
                    font-weight:normal;
                }
                </style>
            </head>
            <body link="#0000ff" vlink="#800080">
                <table BORDER="1" CELLSPACING="0" width="100%">
                <tr><th colspan=" 2" > <big><big><xsl:value-of select="ReportTitle"/> </big></big> &#160; &#160; <small> <xsl:value-of select="ReportDate"/></small></th> </tr>
                            <tr>
     <th>MealTime</th>
     <th>Food</th>
                            </tr>
                    <xsl:for-each select="qrMealTimeFoodListReportLIKE">
                            <tr>
   <td align="center">  <xsl:value-of select="MealTime"/>  </td>
   <td align="center">  <xsl:value-of select="Food"/>  </td>
                            </tr>
                        <!-- Prepare for any expressions in the group footer -->
                    </xsl:for-each><!-- Prepare for any expressions in the group footer -->
                </table>
            </body>
        </html>
    </xsl:template>
</xsl:stylesheet>

装箱表:

MealTime Food List Report LIKE     2019-06-14 12:10:19
MealTime                 Food

3/28/2018 2:06:52 PM    ChocolateMousse - Chocolate Mousse -  
5/18/2018 11:45:53 AM    ChocolateMousse - Chocolate Mousse -

1 个答案:

答案 0 :(得分:0)

这是您的示例,其中XSLT代码嵌入XML文档中,并由xml-stylesheet处理指令引用:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE dataroot [
  <!ATTLIST xsl:stylesheet
    id ID #IMPLIED>
]>
<?xml-stylesheet type='text/xsl' href='#my-sheet'?>
<dataroot generated='2019-06-14T12:10:19'>
    <ReportTitle>MealTime Food List Report LIKE</ReportTitle>
    <ReportDate>2019-06-14  12:10:19</ReportDate>

    <reportdatetime>14 Jun 2019 12:10:19</reportdatetime>

    <qrMealTimeFoodListReportLIKE>
        <MealTime>3/28/2018 2:06:52 PM</MealTime>
        <Food>ChocolateMousse - Chocolate Mousse - </Food>
    </qrMealTimeFoodListReportLIKE>

    <qrMealTimeFoodListReportLIKE>
        <MealTime>5/18/2018 11:45:53 AM</MealTime>
        <Food>ChocolateMousse - Chocolate Mousse - </Food>
    </qrMealTimeFoodListReportLIKE>

    <xsl:stylesheet id="my-sheet" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:fx="#fx-functions" exclude-result-prefixes="msxsl fx">
        <xsl:output method="html" version="4.0" indent="yes" />
        <xsl:template match="dataroot">
            <html>
                <head>
                    <title>MealTimeFoodListReportLIKE</title>
                    <style type="text/css">
                        body
                        {
                        background-color:white;
                        color:black;
                        font-family:arial;
                        font-selection-strategy:auto;
                        font-size:9pt;
                        font-stretch:normal;
                        font-size-adjust:none;
                        font-style:normal;
                        font-variant:normal;
                        font-weight:normal;
                        }
                    </style>
                </head>
                <body link="#0000ff" vlink="#800080">
                    <table BORDER="1" CELLSPACING="0" width="100%">
                        <tr><th colspan=" 2" > <big><big><xsl:value-of select="ReportTitle"/> </big></big> &#160; &#160; <small> <xsl:value-of select="ReportDate"/></small></th> </tr>
                        <tr>
                            <th>MealTime</th>
                            <th>Food</th>
                        </tr>
                        <xsl:for-each select="qrMealTimeFoodListReportLIKE">
                            <tr>
                                <td align="center">  <xsl:value-of select="MealTime"/>  </td>
                                <td align="center">  <xsl:value-of select="Food"/>  </td>
                            </tr>
                            <!-- Prepare for any expressions in the group footer -->
                        </xsl:for-each><!-- Prepare for any expressions in the group footer -->
                    </table>
                </body>
            </html>
        </xsl:template>
    </xsl:stylesheet>
</dataroot>

我认为也可以与Firefox 68和Chrome 75配合使用。