RE: [xsl] Using native XPath in IE with Javascript

Subject: RE: [xsl] Using native XPath in IE with Javascript
From: Joe Fawcett <joefawcett@xxxxxxxxxxx>
Date: Wed, 20 Feb 2008 08:34:01 +0000
Manfred

To retrieve the underlying XML document in IE you need document.XMLDocument.
This gives an instance of msxml2.domdocument.3.0 loaded with the base XML.


Joe
http://joe.fawcett.name
> Date: Tue, 19 Feb 2008 17:45:56 +0100
> From: manfred.staudinger@xxxxxxxxx
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] Using native XPath in IE with Javascript
>
> Hi,
>
> On 18/02/2008, Abel Braaksma  wrote:
>> Using XSLT in a browser through JavaScript is usually easiest with the
>> excellent open source Sarissa, which takes away the burden of little
>> differences in calling XPaths directly (i.e., the function parameter for
>> the namespace is at the end in FF/Op and at the beginning in IE).
> Thanks for remembering me on that. I had a look on it some time ago,
> but I don't use it, mainly because it requires ActiveX to be activated
> in the browser. But I certainly did not know the superb documentation
> "Howto", which was a great help for me to sort things out
>
> I did not, however, solve my IE6 problems. As it seems I don't have an
> XML document:
> alert(document.xml); ... undefined
> alert(document.documentElement.nodeName); ... HTML
> document.setProperty("SelectionLanguage", "XPath"); ... Object
> doesn't support this property or method
>
> Here is my checklist:
> 1. the browser gets an xml file from the server with application/xml
> 2. the PI triggers the XSLT which is served with application/xsl+xml
> 3. the xsl:output method="xml"
>
> Is something missing here? Or is my diagnosis wrong?
>
> Regards,
> Manfred
> http://documenta.rudolphina.org/
>
> On 18/02/2008, Abel Braaksma  wrote:
>> Manfred Staudinger wrote:
>>> Hi,
>>>
>>>>From a posting back in 2004 by Dimitri Glazkov, speaking about IE (I
>>> would be interested in the second case only):
>>> I mean, you can very much do XPath in JavaScript, except it can
>>> only occur in two
>>> cases (that I know of):
>>> 1) As call to an Msxml.DOMDocument object, created using the new
>>> ActiveXObject() statement.
>>> 2) If an HTML document was generated as a result of a client-side
>>> XSL transformation
>>> from an XML file.
>>> http://glazkov.com/blog/xpath-unleashed/
>>>
>>
>> 3) on the current HTML document that is loaded in the browser. However,
>> note that you have to reload it in a freethreaded DOM object to make it
>> work with XSLT (iirc).
>>
>> 4) in an msxml:script object, though I wouldn't recommend it.
>>
>> Using XSLT in a browser through JavaScript is usually easiest with the
>> excellent open source Sarissa, which takes away the burden of little
>> differences in calling XPaths directly (i.e., the function parameter for
>> the namespace is at the end in FF/Op and at the beginning in IE).
>>
>> Cheers,
>> -- Abel Braaksma

Current Thread