How to hide a leaf-list node when a particular list is chosen?

My YANG model is this:

list appA
{
uses app-policy-grouping;
}
list appB
{
uses app-policy-grouping;
}

grouping app-policy-grouping
{
leaf-list val1
{
}
leaf-list val2
{
}
leaf-list val3
{
}
}

I want to hide leaf-list node val3 if the parent node is appA. How do I do it? Do I say

leaf-list val3
{
  when "../appA";
}

Or do I use tailf:depedency extension? If so, how do I use tailf:depedency?

The XPath expression for the when statement:

    leaf-list val3 {
      type string;
      when "name(..)='my-prefix:appA'";
    }

See
https://www.w3.org/TR/1999/REC-xpath-19991116/#function-name
and
https://www.w3.org/TR/1999/REC-xpath-19991116/#path-abbrev
( .. selects the parent of the context node)

Another alternative is to add the below to an annotation module:

tailf:annotate "/my-prefix:appA/my-prefix:val3" {
    tailf:hidden full;
}

@cohult, thanks. Could you tell me what my-prefix here is? Is it an internal keyword?

Also, what if I have another app named appAAA? Would the prefix check still work for just appA?

At the top of your YANG model, look for the “prefix your-prefix-name” statement.
YANG 1.1 RFC description: RFC 7950 - The YANG 1.1 Data Modeling Language

Anyway, if you want to/can skip the prefix, just use “local-name”

    leaf-list val3 {
      type string;
      when "local-name(..)='appA'";
    }
    leaf-list val3 {
      type string;
      when "starts-with(local-name(..), 'appA')";
    }

https://www.w3.org/TR/1999/REC-xpath-19991116/#function-starts-with