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

Re: String Match

Subject: Re: String Match
From: John Robert Gardner <jrgardn@xxxxxxxxx>
Date: Tue, 21 Dec 1999 23:07:36 -0500 (EST)
xsl string match
On Tue, 21 Dec 1999 anupama@xxxxxxxxxxxxxxx wrote:

> I replaced
> with
> <xsl:template match="//div3/li">
>      <xsl:if test="contains(. , 'ILe')">
>           <xsl:copy-of select='.'/>
>      </xsl:if>
> </xsl:template>

Great, this got the match.  The problem I found, however, was when I
applied this to a larger file and for some reason //div3/li needed to be
//div3//li due to the intervening <ol> in the source.  TO return the div3
with the verse identifier (the relevant point for hte scholars I'm hoping
to helpuse this technology), I had to do as follows withyour matching
solution:

<xsl:template match="//div3//li">
     <xsl:if test="contains(. , 'ILe')">
          <xsl:copy-of select='ancestor::div3'/>
     </xsl:if>
</xsl:template>

THank you very much for helping, and be assured you'll find a credit in
the upcoming issue of Int'l Jnl of Tantric Studies.

jr

> 
> I get
> <li class="T">
> agni;m ILe puro;hitaM yajJa;sya deva;m Rtvi;jam /
> </li>
> <li>ILe</li>
> 
> as output using LotusXsl
> 
> 
> 
> -Ana
> 
> 
> 
> 
> 
> 
> John Robert Gardner <jrgardn@xxxxxxxxx>@mulberrytech.com on 12/21/99
> 03:44:16 PM
> 
> Please respond to xsl-list@xxxxxxxxxxxxxxxx
> 
> Sent by:  owner-xsl-list@xxxxxxxxxxxxxxxx
> 
> 
> To:   xsl-list@xxxxxxxxxxxxxxxx
> cc:
> 
> Subject:  String Match
> 
> Also, there is the simple matter of trying to find a word in a basic
> heirarchy:
> 
> <?xml version="1.0"?>
> <html>
> <body bgcolor="#ffffff">
> <div class="Rgveda">
> <div1 class="maNDala" id="1">
> <div2 class="hymn" id="1.1">
> <div3 class="verse" id="1.1.1">
> <ol class="mantra" type="a">
>      <li class="T">
> agni;m ILe puro;hitaM yajJa;sya deva;m Rtvi;jam /
> </li>
> <li>ILe</li>
> <li class="T">
> ho;tAraM ratnadhA;tamam //
> </li>
> </ol>
> </div3>
> </div2>
> </div1>
> </div>
> </body>
> </html>
> 
> 
> 
> THis does not work, nor does any multitude of versions of contains &c.
> (the word I'm tyring to find is ILe-- and it was even made a total
> freebie by fake-creating a node with only ILe as content-- in reality, I
> need ot get all div3's that have an <li> which contain ILe _somewhere_
> within them):
> 
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                 version="1.0"
>                 >
> 
> <xsl:output type="xml" indent="yes"/>
> 
> <xsl:template match="/">
> <xsl:apply-templates />
> </xsl:template>
> 
> <xsl:template match="//li">
> <xsl:copy>
> <xsl:apply-templates mode="copy" select="div3[ol/li='ILe']" />
> </xsl:copy>
> </xsl:template>
> 
> </xsl:stylesheet>
> 
> =-=-=-=-=-=-=-=-=-==-=-=-=
> John Robert Gardner
> ATLA-CERTR
> Emory University
> ------------------------------------------------------------
> http://vedavid.org/diss/
> "If there is something you're thinking of doing, or wish you could do,
> begin it.  In boldness there is mystery and power . . . . "  -Goethe
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

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.