I need to provide an option to generate my SQL report result data in a form that can be easily viewed by most web browsers.
RE: Why is my XSL file no longer being applied to my XML file?Why is my XSL file no longer being applied to my XML file?
<?xml version='1.0' encoding='UTF-8'?>
<?xml-stylesheet type="text/xsl" href="#stylesheet"?>
<!DOCTYPE dataroot [ <!ATTLIST xsl:stylesheet id ID #REQUIRED>]>
<dataroot generated='2019-07-22T11:17:37'>
<xsl:stylesheet id="stylesheet" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="xsl:stylesheet" />
<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>SearchMealTimeFoodQuantityP</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=" 4" > <big><big><xsl:value-of select="ReportTitle"/> </big></big>     <small> <xsl:value-of select="ReportDate"/></small></th> </tr>
<tr>
<th>MealTime</th>
<th>Food</th>
<th>FoodDescription</th>
<th>Quantity</th>
</tr>
<xsl:for-each select="qrSearchMealTimeFoodQuantityP">
<tr>
<td align="center"> <xsl:value-of select="MealTime"/> </td>
<td align="center"> <xsl:value-of select="Food"/> </td>
<td align="center"> <xsl:value-of select="FoodDescription"/> </td>
<td align="center"> <xsl:value-of select="Quantity"/> </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>
<ReportTitle>Search MealTime Food Quantity P</ReportTitle>
<ReportDate>2019-07-22 11:17:37</ReportDate>
<reportdatetime>22 Jul 2019 11:17:37</reportdatetime>
<qrSearchMealTimeFoodQuantityP>
<MealTime>5/24/2019 1:10:35 PM</MealTime>
<Food>BvgChocolateMilkshake</Food>
<FoodDescription>Chocolate Milkshake</FoodDescription>
<Quantity>Large = Venti = 20oz</Quantity>
</qrSearchMealTimeFoodQuantityP>
<qrSearchMealTimeFoodQuantityP>
<MealTime>5/19/2019 1:30:53 PM</MealTime>
<Food>BvgChocolateMilkshake</Food>
<FoodDescription>Chocolate Milkshake</FoodDescription>
<Quantity>XLarge = 24oz</Quantity>
</qrSearchMealTimeFoodQuantityP>
<qrSearchMealTimeFoodQuantityP>
<MealTime>3/24/2019 1:00:20 PM</MealTime>
<Food>BvgChocolateMilkshake</Food>
<FoodDescription>Chocolate Milkshake</FoodDescription>
<Quantity>Large = Venti = 20oz</Quantity>
</qrSearchMealTimeFoodQuantityP>
</dataroot>
This works in Firefox 68, but is it reasonably well structured? Before I modify my program code to generate the SQL report data files in a similar fashion.
In the above example, does this part seem "well formed"?
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE dataroot [ <!ATTLIST xsl:stylesheet id ID #REQUIRED>]>
<?xml-stylesheet type="text/xml" href="#stylesheet"?>
Also, does this part seem "well formed"?
<xsl:stylesheet id="stylesheet" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="//dataroot" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
I have used this format to imbed xslt style code in two additional .xml query report files. Does this approach seem worth programming into my applications or are there some suggested improvements from people who really know what they are doing?
After reading some entries on the web, I made some changes: I moved
<?xml-stylesheet type="text/xsl" href="#stylesheet"?>
before DOCTYPE with changes: xml-stylesheet type was also changed to "text/xsl" as a step towards compatibility with IE 8.
Insert after xsl-stylesheet:
<xsl:template match="xsl:stylesheet" />
I do not know if these changes significantly improve the structure, or if the comments in the previous question pertained to the formatting of the xsl style coding itself?