xsl-list
[Top] [All Lists]

[xsl] Portability of data URIs

2008-06-13 15:25:56
"Michael" == Michael Kay <mike(_at_)saxonica(_dot_)com> writes:

    Andrew> Settling on the complete function and which processors support
    Andrew> it would be good... although I guess using the data scheme is
    Andrew> just as processor dependent as an extension function.

    Michael> Arguably it's less portable, since there are no
    Michael> interrogatives to determine which URI schemes are
    Michael> supported...

In this case, there is a test. Fn:doc-available() is a reliable test for
the support of the data URI, in as much as it will return false() if
it is not supported, or if the URI is mal-formed, but will otherwise
return true(). Which is all that you need to know.

But as for what I said earlier today, about the only accurate thing was
that I was talking nonsense. Now I've had a couple of pints of mild
inside me, my thoughts are more lucid.
There is no problem with the encoding - you have to call
fn:encode-for-uri() to the content, and therefore declare the charset
as UTF-8.

So I think the best you can do for portability is to call
function-available on a data URI. If that returns true(), use that.
If not, call function-available() on known extension functions, one by
one.
Or try the extension functions first.

If all tests fail, then xsl:message.

As Andrew suggests, this could be written as a standard xsl:function.
It could then be placed it the FAQ.
-- 
Colin Adams
Preston Lancashire

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--