- markup (52)
- xml (7)
- xslt (21)
- atom (8)
- overlapping markup (2)
- schema (9)
- creole (4)
- xforms (1)
- pipelines (7)
- coding (2)
- dtll (1)
- genealogy (3)
- gtd (1)
- hardware (1)
- legislation (1)
- ontologies (2)
- unicode (1)
- web (24)
- google (3)
- rdf (6)
- rest (3)
- wikis (1)
- work (1)
- xpath (1)
- xquery (1)
- xtech2008 (3)
- life (26)
- children (5)
- equality (6)
- environment (4)
- gadgets (5)
- software (3)
- xlinq (2)
- conferences (7)
- xtech (6)
- blog (7)
- drupal (3)
Re: Readable regexs
For the record, I think the position in Saxon 8.9.0.3 is that the regex is recognized as constant if the variable is inlined, and variables are inlined if they are local and referenced exactly once and the reference is not in a looping construct such as for-each. (I may be simplifying the rules here.) So the example where you create a local variable and then reference it as regex=”{$r}” works fine (whether or not you declare a type for the variable), but if you use the variable in more than one place, or in a for-each loop, or if it’s a global variable, then I think it might not be recognized as constant, and you will then incur the cost of regex compilation on each use.
This gets a bit cleverer in the next release, but looking at a test case it’s not yet as clever as I would like! (Another new optimization, whereby chunks of code that depend only on global variables get moved out of templates and functions into new global variables, is getting in the way. Conflicts between different rewrite rules are becoming an increasing problem.)