QuickFix for removing whitespaces
Posted: Tue Oct 29, 2024 6:00 pm
Hello,
I am still new to creating schematron rules and currently trying to develop a quickfix that removes all whitespace within a <p> tag. The schematron rule works correctly, but the quickfix also eliminates spaces before and after inline elements. Is there a simple solution for this, or do I need to reconstruct the p-tag using the concat function?
I would be grateful for any help.
I am still new to creating schematron rules and currently trying to develop a quickfix that removes all whitespace within a <p> tag. The schematron rule works correctly, but the quickfix also eliminates spaces before and after inline elements. Is there a simple solution for this, or do I need to reconstruct the p-tag using the concat function?
I would be grateful for any help.
Code: Select all
<pattern id="normalize-p-tag">
<rule context="p">
<assert test="normalize-space(.) = ." sqf:fix="normalize">whitespaces found</assert>
<sqf:fix id="normalize">
<sqf:description>
<sqf:title>normalize p-tag</sqf:title>
</sqf:description>
<sqf:replace match="node()" select="normalize-space(.)"/>
</sqf:fix>
</rule>
</pattern>