Altova Mailing List Archives>Archive Index >xsl-list Archive Home >Recent entries >Thread Prev - Re: [xsl] Searching text within a node >Thread Next - Re: [xsl] Searching text within a node Re: [xsl] Searching text within a nodeTo: xsl-list@-----.------------.--- Date: 8/6/2009 8:14:00 PM I have one more problem. I also need to test for the non-existence of the node <LastName> using an "or" on the "if" statement. So something like <xsl:if test="'Smith'=Form/Names/LastName or "> Thanks. On Thu, 06 Aug 2009 08:10:40 -0500 "Lee" <lee@h...> wrote: > Thank you. Your example got me where I needed to be. >It's often the syntax that trips up beginners. > > <xsl:if test="'Smith'=Form/Names/LastName"> > > > On Tue, 4 Aug 2009 21:33:49 +0200 > Michael Ludwig <milu71@g...> wrote: >> Lee schrieb am 04.08.2009 um 14:13:12 (-0500): >>> >>> I have a block of xml that looks like the following. >>> >>> <Form> >>> <Names> >>> <LastName>Jones</LastName> >>> <LastName>Smith</LastName> >>> <LastName>Anderson</LastName> >>> </Names> >>> </form> >> >> Not well-formed :-) >> >>> I need to display blocks of code only if text matches >>>the >>> text in any of the three nodes(or more) in LastName. So >>> you may have a block of code that should display only if >>> "Jones" is in the above nodes. >> >> michael@wladimir:~/win-dev/XSLT :-) expand -t2 lee.xml >> <?xml version="1.0"?> >> <Form> >> <Names> >> <LastName>Jones</LastName> >> <LastName>Smith</LastName> >> <LastName>Anderson</LastName> >> </Names> >> </Form> >> michael@wladimir:~/win-dev/XSLT :-) expand -t2 lee.xsl >> <xsl:stylesheet version="1.0" >> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> >> >> <xsl:param name="in" select="'Jones'"/> >> >> <xsl:template match="Form"> >> <xsl:if test="$in = Names/LastName"> >> <Match><xsl:copy-of select="$in"/></Match> >> </xsl:if> >> </xsl:template> >> >> </xsl:stylesheet> >> michael@wladimir:~/win-dev/XSLT :-) xsltproc lee.xsl >>lee.xml >> <?xml version="1.0"?> >> <Match>Jones</Match> >> michael@wladimir:~/win-dev/XSLT :-) xsltproc >>--stringparam in x lee.xsl lee.xml >> michael@wladimir:~/win-dev/XSLT :-) # no match, no >>output >> >> Michael Ludwig >> >> --~------------------------------------------------------------------ >> XSL-List info and archive: >> http://www.mulberrytech.com/xsl/xsl-list >> To unsubscribe, go to: >>http://lists.mulberrytech.com/xsl-list/ >> or e-mail: >><mailto:xsl-list-unsubscribe@l...> >> --~-- >> > > > --~------------------------------------------------------------------ > XSL-List info and archive: > http://www.mulberrytech.com/xsl/xsl-list > To unsubscribe, go to: >http://lists.mulberrytech.com/xsl-list/ > or e-mail: ><mailto:xsl-list-unsubscribe@l...> > --~-- > --~------------------------------------------------------------------ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/ or e-mail: <mailto:xsl-list-unsubscribe@l...> --~-- | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
