I have this leaf structure and I Want to remove leafs that have attribute:d value="true".
<outer_element>
<leaf name="abc">
<attribute:a value="1"/>
<attribute:b value="2"/>
<attribute:c value="3"/>
<attribute:d value="true"/>
</leaf>
<leaf name="xyz">
....
</leaf>
</outer_element>
Here is the case I have written,
if(string(node-name($node)) = "leaf" )
then
let $flag :=
for $child in $node/node()
if(name($child) eq "d" and $child/@value eq "true")
then
return "true"
else
return "false"
if (contains ($flag,"true"))
then
()
else
element
{
node-name($node)
}
{
$node/@*
,
for $child in $node/node()
return my:filterfun($child)
}
else
element
{
node-name($node)
} {
$node/@*
,
for $child in $node/node()
return my:filterfun($child )
}
I am having trouble putting up it right,getting errors. Any help is appreciated. Thanks