[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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


Subject: Re: [xsl] I thought i knew how to do this -- followup
From: Markus Abt <abt@xxxxxxxx>
Date: Thu, 24 Feb 2011 01:05:23 +0100

russurquhart1@xxxxxxxxxxx wrote:
> 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.
No. There must be another reason for your result.

You can replace
	./@filter='filter1' and not(contains(@filter, 'filter17'))
by:
	@filter='filter1'

> (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'
correct

> but fully expected
>
> contains(. , 'filter1') to match  @filter='filter17'.
correct (if . is @filter)

Regards,
Markus


Current Thread
Keywords
xsl