My team is currently leveraging SonarQube to do code quality checks on our Mulesoft API implementations. SonarQube uses XPATH 1.0 to create custom rules on mule 4 code. The issue we are currently facing is that, in the event there is same named elements with same named attributes there is no explicit way loop over them and match their values with regex. For example:
<a>
<b>
<c d='123'></c>
</b>
<b>
<c d='123'></c>
</b>
<b>
<c d='123'></c>
</b>
<b>
<c d='xyz'></c>
</b>
</a>
The rule would be to determine if all attributes 'd' are using digits only. This rule could be done using XPATH 2.0 thus:
every $value in /a/b/c/@d satisfies matches($value, '^\d+$')
However as this is not valid in SonarQube is there a way in XPATH 1.0 that this rule can be achieved?