...

View Full Version : Xpath "OR" Question



ideonexus
04-09-2009, 10:12 PM
I have these two working Xpath queries:



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:



(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. :)

ideonexus
04-10-2009, 02:38 PM
Took me forever to figure it out, but here's the solution for anyone who's interested. It works fantastically:



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!!! :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum