Page 1 of 1

Schematron and Whitespaces

Posted: Thu Sep 09, 2021 8:22 pm
by Stacey
Hi:

I've started working with schematron, and one of the things I've noticed is that it doesn't ignore whitespace when looking for text or whatnot, so it doesn't necessarily pull in all of the error results/matching scenarios. Is there a way to indicated that it should ignore that? Or a quick way to update files to remove "extra whitespaces" in the code?

Re: Schematron and Whitespaces

Posted: Fri Sep 10, 2021 9:18 am
by tavy
Hello,

You can create a Schematron rule that ignores whitespaces when searching for some text. For example you can use the matches() function, or you can normalize the text content. You can create also a fix action to remove the extra spaces. I don't know exactly your use case, maybe you can send me an example of XML and the Schematon and I will try to help you.

Here you can find an example of Schematron rule that checks for spaces at the beginning and end of elements:
https://www.oxygenxml.com/doc/versions/ ... pk_g3d_34b

Best Regards,
Octavian