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

RE: question on filtering a one-to-many relationship

Subject: RE: question on filtering a one-to-many relationship
From: Robby Pelssers <Robby.Pelssers@xxxxxxx>
Date: Tue, 6 Mar 2012 10:53:09 +0100
RE:  question on filtering a one-to-many relationship
Thx Michael,

I now understand my stupid mistake.  I should have tested solely on the name
instead of the sequence of names.

Thx for the quick reply !!

Robby

-----Original Message-----
From: Michael Kay [mailto:mike@xxxxxxxxxxxx]
Sent: Tuesday, March 06, 2012 10:48 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  question on filtering a one-to-many relationship

On 06/03/2012 09:30, Robby Pelssers wrote:
> Hi all,
>
> Just to make my use case clear I quickly came up with a simple example
showing my use case.
>
> I need to write a function that enables me to return all<person>'s  which
have at least 1 child that MATCHES a specific search string.
>
>            persons/person[matches(upper-case(children/child/name),
upper-case($searchString))]
>
> Above expression does not work as the matches can only handle a single
string as input and not a sequence of names.  So I was wondering what would be
an elegant way to solve this puzzler?
persons/person[some $n in children/child/name satisifies
matches(upper-case($n), upper-case($searchString))]

or if you prefer to avoid range variables,

persons/person[children/child/name[matches(upper-case(.),
upper-case($searchString))]]

(I'm not sure that applying upper-case() to a regular expression is
particularly good practice, however - for example it will change \w to \W).

Michael Kay
Saxonica
>
> Kind regards,
> Robby Pelssers
>
>
> <persons>
>    <person>
>      <name>Robby</name>
> 	<children>
> 	<child>
> 	<name>Lindsey</name>
> 	<child>
> 	<child>
> 	<name>Valerie<name>
> 	</child>
> 	</children>
>    <person>
>    <person>
>      <name>Audrey</name>
> 	<children>
> 	<child>
> 	<name>Linn</name>
> 	<child>
> 	<child>
> 	<name>Tamara<name>
> 	</child>
> 	</children>
>    </person>
> </persons>

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.