Re: [xsl] attribute test

Subject: Re: [xsl] attribute test
From: Jon Gorman <jonathan.gorman@xxxxxxxxx>
Date: Thu, 15 Sep 2005 16:30:15 -0500
On 9/15/05, Spencer Tickner <spencertickner@xxxxxxxxx> wrote:
> hi guys,
>
> First, Thanks for the suggestions, Unfortunately both return all 3
> test cases first mentioned.  I will continue to try to work this out,
> Once again if you have any more suggestions they are very appreciated.
>

Ah, that's because I must confess to not paying that close of
attention to your original post.
:P

You actually have two conditions:

first, any document that contains one foo that does not have the @att
should print
if all foo have @att then they should not have 'hi'

A quick path of the top of my head (and I did test it) shows

<xsl:template match="/">
  <xsl:if test="/Root/foo[not(@att)] or /Root/foo/@att!='hi'">
    <xsl:apply-templates />
  </xsl:if>
</xsl:template>

works.

Jon Gorman

> Thanks,
>
> Spencer
>
> On 9/15/05, Jon Gorman <jonathan.gorman@xxxxxxxxx> wrote:
> > Ack, been hit by the stolen words gnomes"
> >
> > This
> > > (not() is negation.  When working with node sets and equality (=,!=) I
believe
> > > XPath  returns true if there is any node in the node set that satisifies
the
> > > condition.
> >
> >
> > > I was kinda wondering how that solution was working but figured
> > > perhaps my brain was scrambled today as well ;).
> >
> > Well, apparently it is at least partially scrambled.
> >
> > Jon Gorman

Current Thread