LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   xml style sheet working on windows but not on linux (https://www.linuxquestions.org/questions/programming-9/xml-style-sheet-working-on-windows-but-not-on-linux-263546/)

alix123 12-07-2004 04:48 AM

xml style sheet working on windows but not on linux
 
I have xml and xsl file its working perfectly on windows internet explorer but on linux mozilla it shows an error

"This XML file does not appear to have any style information associated with it. The document tree is shown below."

you can check it below iam giving both xml and xsl file just tell me what is wrong in theat

keep both the file in the same folder and open the xml file with explorer and mozilla


<--*********** xml file start here **********-->
<?xml version="1.0"?>
<?xml:stylesheet type="text/xsl" href="LogFile.xsl"?>
<LogFile>
<Log Date="Datecheck">
<TestCase Result ="Passed"><Column1>1</Column1><Column2>2</Column2><Column3>3</Column3></TestCase>
</Log>
<Log Date="Datecheck">
<TestCase Result ="Passed"><Column1>1</Column1><Column2>2</Column2><Column3>3</Column3></TestCase>
</Log>
</LogFile>

<--*******xml file ends here ************-->




<-- xsl file starts here -->
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<HTML>
<HEAD>
<TITLE>Complete Log Report</TITLE>
</HEAD>
<BODY>
<H1>Complete Log Report</H1>

<xsl:for-each select="LogFile/Log">
Test Case -
Log Date -
<TABLE BORDER="3" CELLSPACING="2" CELLPADDING="2">
<THEAD ALIGN="left" bgcolor="silver">
<TH>Column1</TH>
<TH>Column2</TH>
<TH>Column3</TH>
</THEAD>
<TBODY>
<xsl:for-each select="TestCase">
<TR>
<TD><B><xsl:value-of select="Column1"/></B></TD>
<TD><B><xsl:value-of select="Column2"/></B></TD>
<TD><B><xsl:value-of select="Column3"/></B></TD>
</TR>
</xsl:for-each>
</TBODY>
</TABLE>
</xsl:for-each>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>


<-- xsl file ends her -->

ToniT 12-07-2004 07:14 AM

Code:

apt-get install libxml2-utils
Hint: your document is not valid XML:
Code:

toni@mario:~/work/pub/tst$ xmllint --noout foo.xml
foo.xml:2: parser warning : xmlParsePITarget: invalid name prefix 'xml'
<?xml:stylesheet type="text/xsl" href="LogFile.xsl"?>
                ^
toni@mario:~/work/pub/tst$ xmllint --noout fixed/foo.xml
toni@mario:~/work/pub/tst$ xmllint --noout --relaxng xslt.rng foo.xsl
foo.xsl:2: element stylesheet: Relax-NG validity error : Element stylesheet failed to validate attributes
foo.xsl fails to validate
toni@mario:~/work/pub/tst$ xmllint --noout --relaxng xslt.rng fixed/foo.xsl
fixed/foo.xsl validates
toni@mario:~/work/pub/tst$ diff -ub foo.xml fixed/foo.xml
--- foo.xml    2004-12-07 14:06:36.000000000 +0200
+++ fixed/foo.xml      2004-12-07 14:15:40.000000000 +0200
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<?xml:stylesheet type="text/xsl" href="foo.xsl"?>
+<?xml-stylesheet type="text/xsl" href="foo.xsl"?>
 <LogFile>
 <Log Date="Datecheck">
 <TestCase Result ="Passed"><Column1>1</Column1><Column2>2</Column2><Column3>3</Column3></TestCase>
toni@mario:~/work/pub/tst$ diff -ub foo.xsl fixed/foo.xsl
--- foo.xsl    2004-12-07 14:07:06.000000000 +0200
+++ fixed/foo.xsl      2004-12-07 14:02:15.000000000 +0200
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 <xsl:template match="/">
 <HTML>
 <HEAD>
toni@mario:~/work/pub/tst$



All times are GMT -5. The time now is 08:17 AM.