Open Bug 829136 Opened 13 years ago Updated 3 years ago

xml file with xsl is not correctly displayed

Categories

(Core :: XSLT, defect)

17 Branch
x86_64
Windows 7
defect

Tracking

()

UNCONFIRMED

People

(Reporter: vamruthars, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11 Steps to reproduce: Tried opening the the following XML file in firefox with the XSL added below <?xml version="1.0" encoding="iso-8859-1"?> <?xml-stylesheet type="text/xsl" href="Sample.xsl"?> <!-- Edited by XMLSpy® --> <catalog> <cd> <title>Empire Burlesque</title> <artist>Bob Dylan</artist> <country>USA</country> <company>Columbia</company> <price>10.90</price> <year>1985</year> </cd> <cd> <title>Hide your heart</title> <artist>Bonnie Tyler</artist> <country>UK</country> <company>CBS Records</company> <price>9.90</price> <year>1988</year> </cd> <cd> <title>Greatest Hits</title> <artist>Dolly Parton</artist> <country>USA</country> <company>RCA</company> <price>9.90</price> <year>1982</year> </cd> <cd> <title>Still got the blues</title> <artist>Gary Moore</artist> <country>UK</country> <company>Virgin records</company> <price>10.20</price> <year>1990</year> </cd> <cd> <title>Eros</title> <artist>Eros Ramazzotti</artist> <country>EU</country> <company>BMG</company> <price>9.90</price> <year>1997</year> </cd> <cd> <title>One night only</title> <artist>Bee Gees</artist> <country>UK</country> <company>Polydor</company> <price>10.90</price> <year>1998</year> </cd> <cd> <title>Sylvias Mother</title> <artist>Dr.Hook</artist> <country>UK</country> <company>CBS</company> <price>8.10</price> <year>1973</year> </cd> <cd> <title>Maggie May</title> <artist>Rod Stewart</artist> <country>UK</country> <company>Pickwick</company> <price>8.50</price> <year>1990</year> </cd> <cd> <title>Romanza</title> <artist>Andrea Bocelli</artist> <country>EU</country> <company>Polydor</company> <price>10.80</price> <year>1996</year> </cd> <cd> <title>When a man loves a woman</title> <artist>Percy Sledge</artist> <country>USA</country> <company>Atlantic</company> <price>8.70</price> <year>1987</year> </cd> <cd> <title>Black angel</title> <artist>Savage Rose</artist> <country>EU</country> <company>Mega</company> <price>10.90</price> <year>1995</year> </cd> <cd> <title>1999 Grammy Nominees</title> <artist>Many</artist> <country>USA</country> <company>Grammy</company> <price>10.20</price> <year>1999</year> </cd> <cd> <title>For the good times</title> <artist>Kenny Rogers</artist> <country>UK</country> <company>Mucik Master</company> <price>8.70</price> <year>1995</year> </cd> <cd> <title>Big Willie style</title> <artist>Will Smith</artist> <country>USA</country> <company>Columbia</company> <price>9.90</price> <year>1997</year> </cd> <cd> <title>Tupelo Honey</title> <artist>Van Morrison</artist> <country>UK</country> <company>Polydor</company> <price>8.20</price> <year>1971</year> </cd> <cd> <title>Soulsville</title> <artist>Jorn Hoel</artist> <country>Norway</country> <company>WEA</company> <price>7.90</price> <year>1996</year> </cd> <cd> <title>The very best of</title> <artist>Cat Stevens</artist> <country>UK</country> <company>Island</company> <price>8.90</price> <year>1990</year> </cd> <cd> <title>Stop</title> <artist>Sam Brown</artist> <country>UK</country> <company>A and M</company> <price>8.90</price> <year>1988</year> </cd> <cd> <title>Bridge of Spies</title> <artist>T`Pau</artist> <country>UK</country> <company>Siren</company> <price>7.90</price> <year>1987</year> </cd> <cd> <title>Private Dancer</title> <artist>Tina Turner</artist> <country>UK</country> <company>Capitol</company> <price>8.90</price> <year>1983</year> </cd> <cd> <title>Midt om natten</title> <artist>Kim Larsen</artist> <country>EU</country> <company>Medley</company> <price>7.80</price> <year>1983</year> </cd> <cd> <title>Pavarotti Gala Concert</title> <artist>Luciano Pavarotti</artist> <country>UK</country> <company>DECCA</company> <price>9.90</price> <year>1991</year> </cd> <cd> <title>The dock of the bay</title> <artist>Otis Redding</artist> <country>USA</country> <company>Atlantic</company> <price>7.90</price> <year>1987</year> </cd> <cd> <title>Picture book</title> <artist>Simply Red</artist> <country>EU</country> <company>Elektra</company> <price>7.20</price> <year>1985</year> </cd> <cd> <title>Red</title> <artist>The Communards</artist> <country>UK</country> <company>London</company> <price>7.80</price> <year>1987</year> </cd> <cd> <title>Unchain my heart</title> <artist>Joe Cocker</artist> <country>USA</country> <company>EMI</company> <price>8.20</price> <year>1987</year> </cd> </catalog> ********************************************************** Stylesheet used: <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <div> <xsl:for-each select="catalog/cd"> <p><xsl:value-of select="title" /></p> </xsl:for-each> </div> </xsl:template> </xsl:stylesheet> Actual results: Firefox displays incorrect output Expected results: The output should resemble the output in w3schools URL: http://www.w3schools.com/xsl/tryxslt.asp?xmlfile=cdcatalog&xsltfile=tryxsl_for-each_title
Component: Untriaged → XSLT
Product: Firefox → Core
try using XSLT <xsl:output> Element as follows: <xsl:output method="html" encoding="ISO-8859-1"/>
Thanks, but this was helpful for only the XML/XSL that I had posted before For the XML/XSL below, IE formats the output as expected but firefox displays without and formatting ******************************************************************************** XML File <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type='text/xsl' href='C:\Cat\Trackers\E10106\test.xsl'?> <XMLData> <StudentList> <Name>ABCDEFGHIJKLMNOPQRSTUVWXYZ</Name> <City>Chicago</City> <DateAndTime>1/14/2013 10:26 AM</DateAndTime> </StudentList> </XMLData> ******************************************************************************* XSL File <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" encoding="UTF-8"></xsl:output> <xsl:template match="/"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <xsl:apply-templates select="XMLData/StudentList"> </xsl:apply-templates> </html> </xsl:template> <xsl:template match="XMLData/StudentList"> <body style="font-size: 20" bgcolor="#F0F0F0"> <font face ="tahoma"> <center> <b> <xsl:value-of select="./Name"/> </b> </center> <center> <b> <xsl:value-of select="./City"/> </b> </center> <br/> <center> <b> <xsl:value-of select="./DateAndTime"/> </b> </center> <br/> </font> </body> </xsl:template> </xsl:stylesheet> Any help would be appreciated
I don't see anything immediately wrong with it. For that stylesheet you shouldn't need the <xsl:output> either. If you attach the testcase to the bug such that it can be opened directly in the browser (link the xml file to the bugzilla url) that might help to see what's wrong.
Well, I found a couple of things. Firstly, both XML and XSL need to be in the same directory. Next, <head> does not seem to be an accepted tag in firefox. If I handle both of these, I get the output. Well, but my issue is not completely resolved. I think there are a few more unacceptable tags in the full XML that I am trying to use
Yes, for local filesystem access the XML and the XSL needs to be in the same directory. However there should be no such things as forbidden tags. Especially <head>. Attaching a testcase that can be opened directly in the bug would be helpful.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.