[xsl] (solved) test boolean expression in an attribute

Subject: [xsl] (solved) test boolean expression in an attribute
From: Stefan Thull <pop3@xxxxxxxxxxxxxxx>
Date: Fri, 26 Aug 2005 17:23:06 +0200
Hello,

On Fri, Aug 26, 2005 at 12:50:21PM +0100, Michael Kay wrote:
> contains is a function, not an operator. Write contains(@id, 'fon_10')
>
> Michael Kay
> http://www.saxonica.com/
Problem solved:
something like
<xsl:template match="//Task[contains (@Id, 'fon_10')]">
....
        </xsl:template> -->
does the Job.
Thank You
Stefan

>
> > -----Original Message-----
> > From: Stefan Thull [mailto:pop3@xxxxxxxxxxxxxxx]
> > Sent: 26 August 2005 12:28
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: [xsl] test boolean expression in an attribute
> >
> > Hello,
> > I use a project management software, which produce a a
> > xml-file as result.
> > It produces output with ids like:
> > -------example--------
> > <Task Id="nZA1" >
> >   <Name>Bauteil A 01</Name>
[...]
> >   </SubTasks>
> >  </Task>
> > -------- end -----
> > Now I want every <Task> with an 'fon_10' in its Id.
> >
> > I tried it with:
> > </xsl:template>
> >     <xsl:template match="//Task">
> >        <xsl:if test="@Id contains 'fon_10'">
> >         <p>
> >             <xsl:value-of select="Name"/>
> >         </p>
> >            </xsl:if>
> >     </xsl:template>
> > but it throws an error.
> > " Error in expression @Id contains 'fon_10': Unexpected token
> > <name> beyond
> > end of expression"
> >
> > Do you have a hint for me?
> > Tahnk you in advance
> > Stefan Thull

Current Thread