For solution of the task with search and keyword replacement under the dictionary it is necessary to take advantage of following regular expression which selects a word (for example JAVA) having spaces on both sides:
Code:
(?<=\s*)JAVA(?=\s*)
It is impossible to register this expression in function analyze-string, gives out an error. Prompt, please, in what a problem and how it can be solved?
Code:
<xsl:analyze-string select="replace($text, concat('((?<=\s*)', $keyphrase, '(?=\s*))'), '[$1]', 'i')" flags="i" regex="\[(.*?)\]">
<xsl:matching-substring>
<xsl:element name="a">
<xsl:attribute name="href" select="$href" />
<xsl:value-of select="regex-group(1)"/>
</xsl:element>
</xsl:matching-substring>
<xsl:non-matching-substring>
<xsl:value-of select="." />
</xsl:non-matching-substring>
</xsl:analyze-string>