The Code Below works as expected and when Internet is present in the text it gets matched.
<xsl:template name="IndexTerm">
<xsl:param name="matchedRegex">
<xsl:text>(.*)(Internet)(.*)</xsl:text>
</xsl:param>
<xsl:param name="text"></xsl:param>
<xsl:analyze-string select="$text" regex="(.*)(Internet)(.*)" flags="m">
<xsl:matching-substring>
<xsl:call-template name="IndexTerm">
<xsl:with-param name="text">
<xsl:value-of select="regex-group(1)"></xsl:value-of>
</xsl:with-param>
</xsl:call-template>
<xsl:element name="a">
<xsl:attribute name="id">
<xsl:value-of select="generate-id($text)"></xsl:value-of>
</xsl:attribute>
<xsl:value-of select="regex-group(2)"></xsl:value-of>
</xsl:element>
<xsl:value-of select="regex-group(3)"></xsl:value-of>
</xsl:matching-substring>
<xsl:non-matching-substring>
<xsl:value-of select="."></xsl:value-of>
</xsl:non-matching-substring>
</xsl:analyze-string>
</xsl:template>
when the line:
<xsl:analyze-string select="$text" regex="(.*)(Internet)(.*)" flags="m">
is replaced with:
<xsl:analyze-string select="$text" regex="$matchedRegex" flags="m">
it no longer matches the regex. I do need to pass it in as a param. Is there anyway to make this work?
Use an attribute value template
regex="{$matchedRegex}"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With