Subject: Re: xslt function for generating grammatical paradigms
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 21 Apr 2008 13:23:53 +0100
|
> That is, using the example above, can I define $palatal as the
> set of ('S', 'Z', 'C', 'St', and 'Zd') and then write a rule along the
> lines of "in any sequence of a member of the $palatal class followed by
> '-' followed by 'y', the '-' is deleted and the 'y' is replaced by
> 'E'"?
You _could_ do
replace($string,concat('(',string-join($palatal,'|'),')-y'),'$1E')
although unless your xslt engine can spot that the regexp is built from
constant terms it might be more efficient (if less maintainable) to
write the regexp as a string literal rather than build it up out of
smaller strings, then m most likely it will be compiled inta an
efficient regular expression object at compile time.
replace($string,'(S|Z|C|St)-y', '$1E')
David
|