Conditional XPath?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I need a "conditional" XPath expression. Here are the two cases that I want to match:
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; element <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; BatchCount<span style="color:Black; " <span style="color:Red; type<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; xsd:int<span style="color:Black; "<span style="color:Blue; />

<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; element <span style="color:Red; name<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; BatchId<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; simpleType<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; restriction <span style="color:Red; base<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; xsd:int<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; minInclusive <span style="color:Red; value<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 0<span style="color:Black; "<span style="color:Blue; />
<span style="color:Blue; </<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; restriction<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; simpleType<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xsd<span style="color:Blue; :<span style="color:#A31515; element<span style="color:Blue; >

[/code]
So if the <element> node has an attribute type then return it. If it doesnt then look for the <restriction> node and return the base attribute. Is this possible? <hr class="sig Kevin Burton

View the full article
 
Back
Top