[xsl] I thought i knew how to do this -- followup

Subject: [xsl] I thought i knew how to do this -- followup
From: russurquhart1@xxxxxxxxxxx
Date: Wed, 23 Feb 2011 16:06:32 -0600 (CST)
I wanted to thanked everyone who replied. Special thanks to Wendell for patience as i ride my short little school bus of xsl! :)

I want to post my follow up source that appears to work, but also point out an anomaly, to me at least.

The code is as follows:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()" />
    </xsl:copy>
  </xsl:template>
  <xsl:template match="*[@filter]">
    <xsl:choose>
      <!--      <xsl:when test="contains(@filter, 'filter10') or contains(@filter, 'filter1')">-->
      <xsl:when test="contains(@filter, 'filter10') or (./@filter='filter1' and not(contains(@filter, 'filter17')))">
        <xsl:copy>
          <xsl:apply-templates select="@*|node()" />
        </xsl:copy>
      </xsl:when>
      <xsl:otherwise />
    </xsl:choose>
  </xsl:template>
</xsl:stylesheet>


(A little update. A filter value of 'filter1' will ONLY appear by itself and NOT in a string with other values, as i reported yesterday.) With that said i felt sure that  i could THEN test for the 'filter1' value by using a @filter='filter1' type of check. (Thinking the '=' would be a complete, exact type of comparison as opposed to a 'contains' function call.

When i ran the xsl, i did have some @filter='filter17' values, BUT these got matched by my @filter='filter1'  check. (I know because i took that conditional out and no 'filter17' values were output.) Is this correct?

To summarize. I thought:

./@filter='filter1'  would NOT match  @filter='filter17'

but fully expected

contains(. , 'filter1') to match  @filter='filter17'.

When someone get time, no hurry, could they explain this anomaly to me?

Thanks,

Russ

Current Thread