Saxon-JS documentation app search problems
In the documentation app, we search for the supplied search term in all the section documents using substring matching with fn:contains(), but then highlight using regex pattern matching with xsl:analyze-string. Unsurprisingly, this can produce some dodgy results (e.g. searching for "." means all text gets highlighted; searching for "?" results in an uncaught Saxon-JS error "Invalid regular expression /?/").
#2 Updated by Debbie Lockett 11 months ago
- Status changed from New to In Progress
The flag "q" can be used with the regex in xsl:analyze-string to achieve the required result. i.e. (from the Path 3.1 F&O Spec): "All characters in the regular expression are treated as representing themselves, not as metacharacters. In effect, every character that would normally have a special meaning in a regular expression is implicitly escaped by preceding it with a backslash."
Before discovering this flag, I attempted to do the escaping of special characters (as described in the second sentence) explicitly, but hit some problems with Saxon-JS. I'll raise a separate bug.
Please register to edit this issue