Re: Problem using XSL on FF

Jonas Sicking <[email protected]> Wed, 23 Jan 2008 15:30:53 -0800
Newsgroups gmane.comp.mozilla.devel.xml
Message-ID <[email protected]>
The problem is that you are creating a full DOM inside the text area. 
I.e. you are creating the following DOM:

<textarea>
<series>
<values id="car1">3000</values>
<values id="car1">5000</values>
</series>
</textarea>

Note that you are not creating that markup, but rather that *DOM*. I.e. 
you're getting a DOM like

textarea
  + series
     + values
     + values

However textareas expect a single textnode as a child. During normal 
HTML parsing the contents of the textarea is parsed as text, not as 
markup, so you'll always get a textnode as child. However when using 
XSLT in firefox you are directly creating a DOM, not markup that is 
later parsed.

If you use the DOM Inspector you'll see that all the nodes are there and 
that xsl:copy-of worked as it should.

Hope that explains what happens.

Best Regards,
Jonas Sicking

Daniel Tadeu wrote:
> Hi all,
> 
> I'm trying to generate a web page page using XML and XSL, according
> the codes below. When I load the XML on IE6 and IE7, it works. When I
> load the XML on Firefox (2.0.0.11), the command <xsl:copy-of> doesn't
> work. Why it happens? Should I change something on codes?
> 
> Thanks,
> Daniel
> 
> << cars.xml >>
> <xml>
> <search>
> <year>2007</year>
> </search>
> <chart>
> <series>
> <values id="car1">3000</values>
> <values id="car1">5000</values>
> </series>
> </chart>
> </xml>
> 
> << template.xsl >>
> 
> <?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:msxsl="urn:schemas-microsoft-com:xslt" extension-element-
> prefixes="msxsl" version="1.0">
> 
> <xsl:template match="/">
> <textarea rows="40" cols="80" id="meuxml">
> <xsl:copy-of select ="xml/chart"/>
> </textarea>
> <script>
> alert(meuxml.value);
> </script>
> </xsl:template>
> </xsl:stylesheet>