Hi,
I'm trying to develop a regex that will detect recursive template calls in an xsl style sheet.
So far, it has not been really successful.
In the following code, I need to detect that template B is called recursively:
<xsl:template name="A">
blah blha ?!@#?%$#^%?*?&(({}:"><;'[]\/.,./'
<xsl:call-template name="B">
blah blah
</xsl:template>
<xsl:template name="B">
blah blha
<xsl:call-template name="B">
blah blah
</xsl:template>
<xsl:template name="C">
blah blha
<xsl:call-template name="B">
blah blah
</xsl:template>
In this specific case, the reg ex is ok.
In the case I remove the 2nd call to B, the regex matches the last call to B. That shouldn't happen.
(<xsl:template name=\"(?<templateName>\w+)\">.*?(?<=<xsl:call-template name=\"\k<templateName>\">).*?</xsl:template>)+
I'm no regex guru. Any help is welcome.
Thank you.