Firefox and XSLT

G

Geoff

Hello,

I am using Firefox 1.5.0.7 and when I display the following xml file, I get:

Alan
Turing
computer scientist
mathematician
cryptographer

Richard
P
Feynman
physicist
Playing the bongoes


The matching in the .xsl file does not seem to work. The matching should
change the first names to 'bob'. I tried it in IE6 (changed application/xsl
to text/xsl) and it worked fine. Any ideas why match does not work in
Firefox? The two files are:

~~~~~~~~~
people.xml
~~~~~~~~~
<?xml version="1.0"?>
<?xml-stylesheet type="application/xsl" href="people.xsl"?>
<people>
<person born="1912" died="1954">
<name>
<first_name>Alan</first_name>
<last_name>Turing</last_name>
</name>
<profession>computer scientist</profession>
<profession>mathematician</profession>
<profession>cryptographer</profession>
</person>
<person born="1918" died="1988">
<name>
<first_name>Richard</first_name>
<middle_initial>P</middle_initial>
<last_name>Feynman</last_name>
</name>
<profession>physicist</profession>
<hobby>Playing the bongoes</hobby>
</person>
</people>


~~~~~~~~
people.xsl
~~~~~~~~
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="first_name">Bob</xsl:template>
</xsl:stylesheet>
 
M

Martin Honnen

Geoff said:
I am using Firefox 1.5.0.7 and when I display the following xml file, I get:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="first_name">Bob</xsl:template>
</xsl:stylesheet>

That stylesheet has XML output but no root element so with Mozilla
adding e.g.

<xsl:template match="/">
<root>
<xsl:apply-templates/>
</root>
</xsl:template>

should help so that the result tree has a root element and can be
rendered. That root element will then have the text content




Bob
Turing

computer scientist
mathematician
cryptographer



Bob
P
Feynman

physicist
Playing the bongoes

which seems to be what you want.


Or put in
<xsl:eek:utput method="text"/>
and your stylesheet will work without any additional template.

As for the MIME types, see the FAQ
<http://www.mozilla.org/projects/xslt/faq.html>.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top