I'm trying to replace an older perl-based program with xslt. Succinctly put, our docs are authored as composite works, which are split up according to *country code attributes* at run time. If an element doesn't have a country code, it's assumed that it applies to all countries. These country code values are held within semi-colon delimited values (if needed) within the attribute:

<doc>
  <para id="d0e207" country.code="BA-CG;USAF-A;USAF-AM;USAF-C">Misc. information stuff.</para>
  <para id="d0e208" country.code="USAF-A">More content</para>
</doc>


I pass the country code when the xslt is run, via a global param. I am attempting to use <xsl:analyze-string> to test for the existence of the string within the country.code attribute. Here's my template:

<xsl:template match="@*|element()">
<xsl:choose>
  <xsl:when test="not(@COUNTRY.CODE)">
    <xsl:copy>
      <xsl:apply-templates select="@*|element()"/>
    </xsl:copy>
  </xsl:when>
  <xsl:when test="self::*[@COUNTRY.CODE]">
    <xsl:variable name="ccValue">
      <xsl:value-of select="self::*/@COUNTRY.CODE"/>
    </xsl:variable>
   <xsl:analyze-string select="$ccValue" regex="/{$countryCode}\W/">
     <xsl:matching-substring>
       <xsl:copy>
         <xsl:apply-templates select="@*|element()"/>
       </xsl:copy>
     </xsl:matching-substring>
     <xsl:non-matching-substring><!-- do nothing --></xsl:non-matching-substring>
    </xsl:analyze-string>
  </xsl:when>  
</xsl:choose>
</xsl:template>

Passing in the countryCode value within curly-braces is not working. I've tried doubling the braces. Any suggestions?

Thanks,

Rick