xsl-list
[Top] [All Lists]

Re: [xsl] UTF-8 URL encoding with XSLT 1.0

2007-06-02 03:30:49
Ok, in case anybody needs this:

http://dk.php.net/manual/en/function.xsl-xsltprocessor-register-php-functions.php

This is how you use PHP functions from stylesheets. Remember to call
registerPhpFunctions() on the processor and include the PHP namespace
in XSL.

For URL encoding, the function would be: php:function('urlencode',
string($value))


On 6/2/07, Martynas Jusevicius <martynas(_dot_)jusevicius(_at_)gmail(_dot_)com> 
wrote:
Ok, now I get it :) I'm using PHP's XSL, so I guess I'll go better
look for a way to call PHP's functions from stylesheets.

Martynas

On 6/2/07, Michael Kay <mike(_at_)saxonica(_dot_)com> wrote:
> > is there a stylesheet somewhere to encode URLs in XSLT 1.0?
> > So far I'm using one from http://skew.org/xml/stylesheets/url-encode/
> > , but it looks like it cannot handle UTF-8.
>
> Doing UTF-8 is about five orders of magnitude harder than doing Latin-1.
> Instead of a table of 256 characters, you'll need a table of 1114111
> characters. You'll then need to implement the tricky bit-twiddling rules of
> UTF-8 encoding in a language that has no built-in bit-twiddling operators.
> And at the end it will be painfully slow.
>
> In short, doing this in pure XSLT 1.0 without extensions is pure masochism.
> Look for other options. Why are you doing it anyway?
>
> Michael Kay
> http://www.saxonica.com/
>
>
> --~------------------------------------------------------------------
> 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>
> --~--
>
>


--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>