[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Searching text within a node

Subject: Re: Searching text within a node
From: Michael Ludwig <milu71@xxxxxx>
Date: Tue, 4 Aug 2009 21:33:49 +0200
Re:  Searching text within a node
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

Current Thread
  • Searching text within a node
    • Lee - 4 Aug 2009 19:13:41 -0000
      • Michael Ludwig - 4 Aug 2009 19:34:55 -0000 <=
        • Lee - 6 Aug 2009 13:11:03 -0000
          • Lee - 6 Aug 2009 20:13:32 -0000
          • Wendell Piez - 6 Aug 2009 21:25:56 -0000
          • Message not available
          • Lee - 6 Aug 2009 21:45:48 -0000

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.