The ancestor test should really be

```
ancestor-or-self::*[@processing-role][1][@processing-role='resource-only']
```

But since it's not common to have normal resources inside resource-only topicrefs, I think is ok.