Page 1 of 1

Excluding specific XML elements from word count in Vale

Posted: Mon Oct 13, 2025 2:42 pm
by VincentV
Hello,

I'm working on some Vale rules to use with the terminology plugin to check terminology and other style guidelines.
I'm wondering if there's a way to exclude certain elements (like uicontrol or xref) when counting words within a sentence (or to count them as a single word regardless of their length).

So far, I only have a rule that counts all words, no matter which elements they’re in:

Code: Select all

extends: occurrence
message: "sentence too long"
scope: sentence
level: suggestion
max: 25
token: \b(\w+)\b
Is this even possible to achieve with Vale or the terminology plugin?
Thank you.

Re: Excluding specific XML elements from word count in Vale

Posted: Mon Oct 13, 2025 6:36 pm
by adrian_sorop
Hi,

There isn’t a direct way to exclude elements when counting words within a sentence, nor to count them as a single word.
However, there might be a workaround: the Terminology Checker skips space-preserve elements. If your elements use a style such as white-space:pre, they won’t be scanned.

If you create an alternate style that marks xref, uicontrol, etc. as space-preserve, the Terminology Checker will skip these elements.
Here is the latest documentation regarding CSS styling:
https://www.oxygenxml.com/doc/versions/ ... tyles.html

Regards,
Adrian S.

Re: Excluding specific XML elements from word count in Vale

Posted: Tue Oct 14, 2025 9:38 am
by VincentV
Hi Adrian,
thanks a lot – that did the trick!
That probably means those elements are excluded from all other terminology checks as well, right?
How about Schematron - is it affected too?

Re: Excluding specific XML elements from word count in Vale

Posted: Tue Oct 14, 2025 10:10 am
by adrian_sorop
Great to hear!

Yes, you're right. Space preserve elements are excluded from all other terminology checks.

Schematron does not automatically ignore or skip space preserve elements.
The elements are still part of the validation process - the Schematron rules will apply to them just like to any other elements, unless you explicitly tell Schematron to treat them differently.

Regards,
Adrian S.

Re: Excluding specific XML elements from word count in Vale

Posted: Tue Oct 14, 2025 12:26 pm
by VincentV
thanks for the clarification, that works for us!