Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: "like" operator in xpath [Thread Next] Re: "like" operator in xpathTo: NULL Date: 11/1/2004 3:34:00 PM Well contains or starts with depending on what you want LIKE 'find me%' Might be better with starts-with(NODE,$like-string) LIKE '%find me%' Would be contains(NODE,$like-string) I'm not aware of an end-with function so if you needed LIKE 'find-me%' You may need to do something like NODE = substring(NODE,length(NODE)-length($like-string),length($like-string)) "David Carnes" wrote: > (Also answered in microsoft.public.xml) > Daniel: > Use contains() > > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > <xsl:output method='xml' indent='yes' omit-xml-declaration='yes' /> > <xsl:template match="foo"> > <foo> > <xsl:apply-templates select="bar"/> > </foo> > </xsl:template> > > <xsl:template match="bar[contains(@a, 'food')]"> > <bar> > <xsl:attribute name="b"> > <xsl:value-of select="@b"/> > </xsl:attribute> > </bar> > </xsl:template> > </xsl:stylesheet> > > HTH! > Dave > > > "Daniel" <softwareengineer98037@y...> wrote in message > news:eZwXTtevEHA.1308@T...... > > is there any sort of "like" operation in xpath? e.g. convert: > > <foo> > > <bar a="21food" b="alex"/> > > <bar a="food" b="moly"/> > > <bar a="222222" b="ashley"/> > > <bar a="fffooddd" b="sam"/> > > </foo> > > > > to > > > > <foo> > > <bar b="alex"/> > > <bar b="moly"/> > > <bar b="sam"/> > > </foo> > > > > > > > | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
