简体   繁体   中英

Why is my XSL file no longer being applied to my XML file?

I create xml files in a ..\\reports directory They reference a stylesheet eg: '.\\SurveyRespondentList.xsl'

The most recent Firefox Quantum 68.0 (64-bit) does not accept this.
Previous versions have worked over the years
My reports also work on Internet Explorer 11
My applications are open to all and I have been using this approach to create and display database query reports for years.

ALL of the report files are file:// URLs created for the user on their local PC by the programs I created for their use on their local PC. The intent is they can view their reports in most any web browser. This approach has worked very well for years (~decade).

I asked Mozilla/Firefox:

  1. Is the simple functionality I have used for years gone forever? Or will some eventual future patch restore it?

"The developers are aware that this patch created problems with HTML-based help documentation, but they weren't able to come up with a way to distinguish legitimate local links from potential attack links. In the future, they might come up with something to allow help documentation to work again and hopefully you would be able to benefit from that, but it's not likely to happen soon."

What are the trends in web browsers?
Does anyone know of another approach?
eg: Is there a reasonable way to embed the xslt/css within the .xml data file?

<?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>

boxed table:

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 -

Here is your example with the XSLT code embedded in the XML document and referenced by the xml-stylesheet processing instruction:

<?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>

Works with Firefox 68 and with Chrome 75 too I think.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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