regex in analyze-string
Added by Anonymous over 19 years ago
Legacy ID: #3244432 Legacy Poster: Torsten Schassan (schassan)
while it is possible to use curly brackets inside of a regex with tokenize() and mask the bracket with the backslash (for example: tokenize($content,'{HYPERLINK','') ), this seems not to be possible inside the regex-attribute of analyze-string. I get this error message: XT0350: Unmatched opening curly brace in attribute value template "{HYPERLINK" What's wrong? My syntax? I use Saxonb8.4 with jdk1.5.0_02.
Replies (1)
RE: regex in analyze-string - Added by Anonymous over 19 years ago
Legacy ID: #3244485 Legacy Poster: Michael Kay (mhkay)
The regex attribute of xsl:analyze-string is an attribute value template, so curly braces have a special meaning. This allows you to write regex="{$var}" This means that any curly brace within the regular expression itself needs to be doubled. Alternatively, it's often easier to write it like this: <xsl:variable name="regex" as="xs:string">abc{3}</xsl:variable> <xsl:analyze-string regex="{$regex}"> Michael Kay
Please register to reply