Web Analytics Made Easy -
StatCounter Xpath "OR" Question - CodingForum

Announcement

Collapse
No announcement yet.

Xpath "OR" Question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Xpath "OR" Question

    I have these two working Xpath queries:

    Code:
    Competency/CompetencyAttributeList/CompetencyAttribute[Name='ASSET_TYPE_VALUE']/Value
    
    Competency/CompetencyAttributeList[not(CompetencyAttribute/Name='ASSET_TYPE_VALUE')]//parent::*/Code
    I'm certain it's possible to merge them into a single statement using an "OR", but I am unsure what the proper syntax for this should be. The following doesn't work:

    Code:
    (Competency/CompetencyAttributeList/CompetencyAttribute[Name='ASSET_TYPE_VALUE']/Value) or (Competency/CompetencyAttributeList[not(CompetencyAttribute/Name='ASSET_TYPE_VALUE')]//parent::*/Code)
    Neither does some variations on this that I've tried. I just started working with Xpath last week, and am floored with how comprehensive it is. Thanks in advance for any assistance anyone can provide.

  • #2
    Solved it!

    Took me forever to figure it out, but here's the solution for anyone who's interested. It works fantastically:

    Code:
    Competency/CompetencyAttributeList/CompetencyAttribute[Name='ASSET_TYPE_VALUE']/Value|//Competency/CompetencyAttributeList[not(CompetencyAttribute/Name='ASSET_TYPE_VALUE')]//parent::*/Code
    The solution was simply to join the two separate queries with "|//" between them. XPATH RULES!!!

    Comment

    Working...
    X