@@ -3690,6 +3690,7 @@ xpath_bit_is_set(struct lyxp_set **args, uint32_t UNUSED(arg_count), struct lyxp
36903690 struct lyd_node_term * leaf ;
36913691 struct lysc_node_leaf * sleaf ;
36923692 struct lyd_value_bits * bits ;
3693+ struct lyd_value * val ;
36933694 LY_ERR rc = LY_SUCCESS ;
36943695 LY_ARRAY_COUNT_TYPE u ;
36953696
@@ -3725,10 +3726,14 @@ xpath_bit_is_set(struct lyxp_set **args, uint32_t UNUSED(arg_count), struct lyxp
37253726 LY_CHECK_RET (rc );
37263727
37273728 set_fill_boolean (set , 0 );
3728- if (args [0 ]-> used ) {
3729+ if (args [0 ]-> used && ( args [ 0 ] -> val . nodes [ 0 ]. node -> schema -> nodetype & LYD_NODE_TERM ) ) {
37293730 leaf = (struct lyd_node_term * )args [0 ]-> val .nodes [0 ].node ;
3730- if ((leaf -> schema -> nodetype & (LYS_LEAF | LYS_LEAFLIST )) && (leaf -> value .realtype -> basetype == LY_TYPE_BITS )) {
3731- LYD_VALUE_GET (& leaf -> value , bits );
3731+ val = & leaf -> value ;
3732+ if (val -> realtype -> basetype == LY_TYPE_UNION ) {
3733+ val = & val -> subvalue -> value ;
3734+ }
3735+ if (val -> realtype -> basetype == LY_TYPE_BITS ) {
3736+ LYD_VALUE_GET (val , bits );
37323737 LY_ARRAY_FOR (bits -> items , u ) {
37333738 if (!strcmp (bits -> items [u ]-> name , args [1 ]-> val .str )) {
37343739 set_fill_boolean (set , 1 );
@@ -4200,17 +4205,21 @@ xpath_derived_(struct lyxp_set **args, struct lyxp_set *set, uint32_t options, l
42004205 leaf = (struct lyd_node_term * )args [0 ]-> val .nodes [i ].node ;
42014206 sleaf = (struct lysc_node_leaf * )leaf -> schema ;
42024207 val = & leaf -> value ;
4203- if (!sleaf || !(sleaf -> nodetype & LYD_NODE_TERM ) || ( leaf -> value . realtype -> basetype != LY_TYPE_IDENT ) ) {
4208+ if (!sleaf || !(sleaf -> nodetype & LYD_NODE_TERM )) {
42044209 /* uninteresting */
42054210 continue ;
42064211 }
42074212 } else {
42084213 meta = args [0 ]-> val .meta [i ].meta ;
42094214 val = & meta -> value ;
4210- if (val -> realtype -> basetype != LY_TYPE_IDENT ) {
4211- /* uninteresting */
4212- continue ;
4213- }
4215+ }
4216+
4217+ if (val -> realtype -> basetype == LY_TYPE_UNION ) {
4218+ val = & val -> subvalue -> value ;
4219+ }
4220+ if (val -> realtype -> basetype != LY_TYPE_IDENT ) {
4221+ /* uninteresting */
4222+ continue ;
42144223 }
42154224
42164225 /* check the identity itself */
0 commit comments