Re: more struggles with POWDER test materials

Hi Kevin.

Kevin Smith:
> Thanks for the snippet, which solves the problem as stated:
> however there was more to the problem than that: namely we need to
> regex-escape the string (not just deal with spaces). There may be
> a way to recurse on the string to achieve this: identify a segment
> before any of the regex reserved characters, concat() the escape,
> recurse until complete; but the problem there is that the escaped
> string still contains the reserved character. XSLT 1's translate()
> function can only cope with the translation of one character into
> another so that doesn't help us.

Indeed you should be able to solve that (and anything computable) in
XSLT 1, since it’s a Turing complete language.

> I wouldn't be surprised if one of the XSLT 1 gurus could find a
> heavyweight multi-template way around this; however it is exactly the
> sort of problem that replace() was introduced to deal with in XSLT
> 2.

Sure, and of course it would be a much better use of someone’s time to
just use XSLT 2 and its replace() function rather than rolling your own
in XSLT 1.  I’m quite enjoying using XSLT 2 at the moment for the SVG
WG’s spec building scripts.  I just wanted to point out that it’s not
impossible.

-- 
Cameron McCormack ≝ http://mcc.id.au/

Received on Friday, 15 May 2009 08:40:13 UTC