Re: Using Javascript to pass a parameter to the <xsl:sort> element

Martin Honnen <[email protected]>
Newsgroups gmane.comp.mozilla.devel.layout.xslt
Organization Liberty Development
Message-ID <[email protected]>

Maria Amuchastegui wrote:

> I am trying to use Javascript to pass a parameter to the <xsl:sort> element. 
> The parameter seems to be getting passed but the data is not sorting. I read 
> "The XSLT/JavaScript Interface in Gecko" but the code does not seem to work. 
> Any suggestions on how to get it to work?

Here is a working XHTML example:
<http://home.arcor.de/martin.honnen/xslt/test2005032201.xhtml>
Take note that the whole page is XHTML served as application/xhtml+xml 
with the normal XHTML elements in the XHTML namespace 
http://www.w3.org/1999/xhtml and your embedded XML data is explicitly in 
the null namespace.

I am surprised that your approach does initially render something but in 
general as XML data islands are not supported in Mozilla any attempt to 
embed XML data in a HTML document served as text/html and then trying to 
process that data as XML has to fail as all there is in the browser DOM 
are not XML elements but unknown HTML elements.

So the problem in your approach is here:

> <xml id="ChargeableMessages" style="display:none;">
>  <chargeablemessages>

What Mozilla sees if you serve all that stuff as text/html is not XML 
but HTML.

If you can't use application/xhtml+xml then you should not embed the XML 
directly inside of the HTML document but load it from an external file 
the same way as you load the XSLT stylesheet.


-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.