Re: [xsl] Client-side cross-platform API

Subject: Re: [xsl] Client-side cross-platform API
From: "Eric J. Bowman" <eric@xxxxxxxxxxxxxxxx>
Date: Sun, 21 Feb 2010 05:03:57 -0700
Robert Koberg wrote:
> >> (javascript)
> >> (xml-stylesheet)
> >> (has text/plain
> >> variants)
> >> 
> >> It's the same *%&#^!@ code either way.  If anything, I'd expect
> >> Opera and WebKit to agree, seeing as how they're both libxslt.
> >> Firefox just works, Opera only works when XSLT is called by
> >> Javascript, WebKit only works when an xml-stylesheet PI is used...
> >> 
> >> So my question is basically "WTF?" but there's really nowhere to
> >> ask it.
> I haven't tried in a while, but Opera did not support the document
> function (I see you are using the document()). From the Opera 9.5
> changelog, support for the document() was added (latest version I see
> is 10.10)

You shouldn't have any problem with this URL in Opera 9.5+ :

It's the same code that seems to fail on document() when called using
an xml-stylesheet PI.  That's called using Javascript, and there are a
bunch of document() calls firing in Opera with no problem.

> If you comment out the document() calls, does it work in Opera?

I think you're missing the problem -- it works in Opera *with* the
document() calls, provided the XSLT is called via Javascript.  (This
took some doing, Opera seems to disallow conditional logic within named
templates.  You can see my annotated XSLT file predates a major
refactoring to replace a call-template with an apply-templates.  This
refactoring had no effect on WebKit, which worked before and after, but
still, only when called via xml-stylesheet.) So it isn't any inherent
failure in Opera to implement document() (although that took 'em long

Here's what got me to cussing, whittled down quite a bit.  Take a look
at line 84 of the simplified XSLT linked here (works in all browsers
but Opera):

Changing line 84 from a copy-of to an apply-templates (which calls the
identity template), not only also fails to import the blogroll, but
causes the document() call on line 99 to fail.  Leaving line 84 as copy-
of doesn't work, but doesn't fail the document() call on line 99.  Of
course, either method will work when the XSLT is called via Javascript.

There is nothing I can do to open an application/atom+xml file using
document(), in Opera, when that document() is called by an xml-
stylesheet PI instead of Javascript.  I can open application/xhtml+xml
or application/atomcat+xml either way, and text/xml only via Javascript.

This basically gives me nothing to go on.  So my problem remains,
either making this work on Opera using xml-stylesheet (preferred), or
figuring out why WebKit fails when the XSLT is called using Javascript.
So long as one or the other method works cross-browser.  I have no idea,
being too new at XSLT, whether we're looking at one or more browser bugs
here, or somewhere my code has gone awry in a generally-noobish fashion.


Current Thread