Xquery attribute value test with wildcard

Discussion in 'XML' started by jule, Jul 17, 2011.

  1. jule

    jule Guest

    Hi

    I am trying to build an xquery that should give all div-element with
    class attribute which value is starting with "post". Something like
    this:

    /div[@class="post*"]

    Any help? Thanks, Jule
    jule, Jul 17, 2011
    #1
    1. Advertising

  2. jule wrote:

    > I am trying to build an xquery that should give all div-element with
    > class attribute which value is starting with "post". Something like
    > this:
    >
    > /div[@class="post*"]


    //div[matches(@class, '^post')]

    --

    Martin Honnen --- MVP Data Platform Development
    http://msmvps.com/blogs/martin_honnen/
    Martin Honnen, Jul 17, 2011
    #2
    1. Advertising

  3. Martin Honnen wrote:
    > jule wrote:
    >
    >> I am trying to build an xquery that should give all div-element with
    >> class attribute which value is starting with "post". Something like
    >> this:
    >>
    >> /div[@class="post*"]

    >
    > //div[matches(@class, '^post')]


    For your simple requirement
    //div[starts-with(@class, 'pos')]
    should suffice but in general matches with regular expression support is
    more powerful.

    --

    Martin Honnen --- MVP Data Platform Development
    http://msmvps.com/blogs/martin_honnen/
    Martin Honnen, Jul 17, 2011
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alain Frisch
    Replies:
    3
    Views:
    410
    Richard Tobin
    May 3, 2005
  2. Replies:
    1
    Views:
    4,222
    Joe Kesselman
    Aug 2, 2006
  3. Replies:
    8
    Views:
    510
  4. kishjeff
    Replies:
    2
    Views:
    744
    kishjeff
    Dec 17, 2008
  5. Replies:
    7
    Views:
    811
Loading...

Share This Page