Actually the "not (A or B)" construction does seem to work; possibly the
boolean condition within the parenthesis -- in this case "(A or B)" --
is evaluated first, and then it applies the "not" ? In other words, it
doesn't appear to "not" the two conditions separately, which means that
"not(A or B)" isn't the same thing as "not(A) or not(B)." The upshot of
it is that the "not(A orB)" construction seems to behave more like
"neither A nor B."
In any case, an easier (and prettier!) way to solve the problem might
be to use the choose/ when/otherwise construction, like so:
<xsl:template match='scopecontent'>
<xsl:choose>
<xsl:when test='parent::*[@level="series" or
@level="subseries"]'>
<p>THIS IS AN S or SS <xsl:apply-templates/> </p>
</xsl:when>
<xsl:otherwise>
<p>THIS IS NOT AN S or SS <xsl:apply-templates/> </p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
This targets the exact element (scopecontent) that you want to format
in a distinct way and doesn't require that pesky "not" at all :)
Michele C.
-=--=--=--=--=--=--=--=--=--=--=--=--=--=-
Michele R. Combs
[log in to unmask]
Manuscripts Processor
Special Collections Research Center
Syracuse University Library
222 Waverly Avenue
Syracuse, NY 13244
(315) 443-2697
-=--=--=--=--=--=--=--=--=--=--=--=--=--=-
>>> [log in to unmask] 2/6/2007 3:29 PM >>>
Hi,
Actually this is a boolean problem...
Forgive the shorthand - this is about the logic not the actual syntax
In the first template you ask for series *or* subseries so that means
anything that isn't a series or a subseries will be excluded
In the second template you ask for not(series or subseries) which is
different than " not(series) and not(subseries)"
AN example:
Of the following items:
seriesA
seriesB
subseriesA
subseriesB
fileA
fileB
documentA
documentB
template1 would retrieve:
seriesA
seriesB
subseriesA
subseriesB
But in template2 I assume what you are trying to retrieve is
fileA
fileB
documentA
documentB
and any other items that are not a series or a subseries
But as you have written it not(series or subseries)
those that are subseries are INCLUDED when you are performing the not()
on the series but those that are series are INCLUDED when you are
performing the not() on the subseries portion of the statement. That
is
ambiguous because of the *OR* in between.
If you write it
not(series) or not(subseries) you still face a similar problem.
If you write not(series and subseries) then you would be looking for
those that had levels that matched both series and subseries. There
would be no matches matches. That isn't correct either.
But if you want to say that you do not want to include series and you
do
not want to include subseries in your results then you should say
"not(series) and not(subseries)" (translated into the correct xslt
syntax).
Hope that helps.
Liz
Lynn Lobash wrote:
> aha. thank you and for the website.
>
> lynn
>
>
>
>
> Michele Combs
> <[log in to unmask]
> >
To
> Sent by: Encoded [log in to unmask]
> Archival
cc
> Description List
> <[log in to unmask]>
Subject
> Re: Not statement?
>
> 02/06/2007 02:12
> PM
>
>
> Please respond to
> Encoded Archival
> Description List
> <[log in to unmask]>
>
>
>
>
>
>
> I think possibly the wildcard double slash is confusing it...the
double
> slash tells it to find scopecontent anywhere in the document; even
when
> you put it in the middle of a string as you have it here, it's still
an
> anywhere-in-the-document match (see "Navigating nodes" at
> http://builder.com.com/5100-6371-1044797-2.html ). If you take out
> the double slash, it works fine. Given that a scopecontent can only
> appear in a c0# or in another scopecontent, you may not need that
double
> slash.
>
> Michele
>
> -=--=--=--=--=--=--=--=--=--=--=--=--=--=-
> Michele R. Combs
> [log in to unmask]
> Manuscripts Processor
> Special Collections Research Center
> Syracuse University Library
> 222 Waverly Avenue
> Syracuse, NY 13244
> (315) 443-2697
> -=--=--=--=--=--=--=--=--=--=--=--=--=--=-
>
>>>> [log in to unmask] 2/6/2007 1:01 PM >>>
> I keep getting an ambiguous rule match error here and I am not
> understanding how these two statements are not opposites:
>
> <xsl:template match='* [@level="series" or
> @level="subseries"]//scopecontent'>
>
> <p>
> <xsl:apply-templates/>
> </p>
> </xsl:template>
>
> <xsl:template match='* [not (@level="series" or
> @level="subseries")]//scopecontent'>
>
> <font size="-1" color="gray">
> <xsl:apply-templates/>
> </font>
> </xsl:template>
>
> Thank you,
> Lynn
>
|