| Author |
workaround for xpath 2.0 exists() function?
|
|
|
|
Having finally discovered that exists() is a xpath 2.0 function is there a
work around?
For example, I want an expression that will select <aaa> elements that do
not have children containing <aaa> tags
<aaa>
<aaa>
<aaa/>
</aaa>
<aaa> // this node wanted
<bbb/>
</aaa>
<aaa> // this node wanted
<ccc/>
</aaa>
</aaa>
I think the following should work
//aaa[exists(child::*) = true() and exists(child::aaa)=false()]
Can this be done in xpath 1.0?
NB. I tried using count() but count returns zero whether or not a child node
exists
| |
|
| Maybe,
aaa[* and not(aaa)]
"rvj" <md@rolemodels.net> wrote in message
news:#RMtBEbiEHA.2992@TK2MSFTNGP12.phx.gbl...
>
> Having finally discovered that exists() is a xpath 2.0 function is there a
> work around?
>
> For example, I want an expression that will select <aaa> elements that do
> not have children containing <aaa> tags
>
> <aaa>
> <aaa>
> <aaa/>
> </aaa>
> <aaa> // this node wanted
> <bbb/>
> </aaa>
> <aaa> // this node wanted
> <ccc/>
> </aaa>
> </aaa>
>
> I think the following should work
>
> //aaa[exists(child::*) = true() and exists(child::aaa)=false()]
>
> Can this be done in xpath 1.0?
>
> NB. I tried using count() but count returns zero whether or not a child
node
> exists
>
>
>
>
>
>
>
| |
|
| thanks !!
"Han" <hp4444@kornet.net.korea> wrote in message
news:O6Ww4NciEHA.348@tk2msftngp13.phx.gbl...
> Maybe,
>
> aaa[* and not(aaa)]
>
> "rvj" <md@rolemodels.net> wrote in message
> news:#RMtBEbiEHA.2992@TK2MSFTNGP12.phx.gbl...
a[color=darkred]
do[color=darkred]
> node
>
>
|
|
|
|
| Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |