RE: [xsl] contains

Subject: RE: [xsl] contains
From: Pieter Reint Siegers Kort <pieter.siegers@xxxxxxxxxxx>
Date: Wed, 2 Jun 2004 10:59:23 -0500
Hi again Hardy,

Maybe I was too quick with my former post... actually, I saw your question
is really a javascript question.

BTW, the Xpath expression should work:

var personNodes =
root.selectNodes("//person[contains(@scrn_fld,'new_user')]");

You may want to try a simpler expression first, like:

var personNodes = root.selectNodes("//persons");

If this works you may need to present the expression's predicate content in
a way that javascript understands. But that's off topic here.

Cheers,
<prs/>

-----Original Message-----
From: Hardy Merrill [mailto:HMerrill@xxxxxxxxxxxxxxxx] 
Sent: Wednesday, June 02, 2004 9:48 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] contains

XSL newbie alert.

We're having problems with the 'contains' statement.  Our XML looks like
this:

   <persons>
         <person scrn_fld="person_1">
                 <name>Joe</name>
         </person>
         <person scrn_fld="new_user_1">
                 <name>Joe</name>
         </person>
         <person scrn_fld="new_user_2">
                 <name>Jim</name>
         </person>
   </persons>

Notice that 'person' attribute 'scrn_fld' can have values starting with
either 'person' or 'new_user'.  In an effort to get only 'new_user'
nodes, we can't get this to work:

    var personNodes = root.selectNodes("//person[contains(@scrn_fld,
'new_user')]");


Note that this code is Javascript code - anyone know if/why Javascript has a
problem with this?  This seems to work ok in ASP.  We're using MSXML 4.0.

TIA.

Hardy Merrill

--+------------------------------------------------------------------
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@xxxxxxxxxxxxxxxxxxxxxx>
--+--

Current Thread