xsl-list
[Top] [All Lists]

Re: [xsl] xslt function for generating grammatical paradigms

2008-04-21 05:25:10

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

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