Hello,
Via javascript I am loading xsl's from tomcat to client. My javascript code was
the following...
// sort the xml using xsl stylesheet
xsl.load("reportwriter/xsl/treesort.xsl");
xml.loadXML(xml.transformNode(xsl));
// Load XSL
xsl.load("reportwriter/xsl/tree.xsl");
This resulted in the following error...
Error: The stylesheet does not contain a document element. The stylesheet may
be empty, or it may not be a well-formed XML document.
I modified the code to the following
// sort the xml using xsl stylesheet
alert(getUrl() + "/reportwriter/xsl/treesort.xsl");
xsl.load(getUrl() + "/reportwriter/xsl/treesort.xsl");
xml.loadXML(xml.transformNode(xsl));
// Load XSL
alert(getUrl() + "/reportwriter/xsl/tree.xsl");
xsl.load(getUrl() + "/reportwriter/xsl/tree.xsl");
the alert show the following
https://localhost:7443/Reporting/reportwriter/xsl/treesort.xls (I never get to
the second alert)
If I cut/paste the url into browser url line it loads and displays without
issue. However, when I run my webapp I still get the following error
Error: The stylesheet does not contain a document element. The stylesheet may
be empty, or it may not be a well-formed XML document.
So it appears the stylesheet is loading a blank file. Any ideas? Is there
something different I need to do with tomcat to load these?
My webapp directory structure is the following
Within tomcat webapps folder I have
Reporting
Logs
META-INF
reportwriter
images
pages
reports
scripts
xml
xsl - this is where the two xsl files are stored
WEB-INF
This is the contents of treesort.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="menu">
<xsl:copy>
<xsl:for-each select="menuItem">
<xsl:sort select="@title"/>
<xsl:copy>
<xsl:copy-of
select="@*"/>
<xsl:for-each
select="menuItem">
<xsl:sort select="@title"/>
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:copy>
</xsl:for-each>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Sincerely,
Robert Jenkin
Surecomp Services, Inc.
2 Hudson Place, 4th Floor
Hoboken, NJ 07030
Skype: robert.jenkin
Office: 201 217 1437 | Direct: 201 716 1219 | Mobile: 908 251 0537
http://www.Surecomp.com
This mail was sent via Mail-SeCure System.