Page 1 of 1

Schematron Quick Fix to Remove Part of an Attribute Value!

Posted: Mon Dec 31, 2018 9:28 am
by mu258770
Hi team,

We are working on adding some schematron quick fixes to some of our specialized schematron rules in oXygen Author 19.1 Eclipse version.

We are stuck in a place that we need to remove part of an attribute value using schematron quick fix.

Consider the below example,

If a user inserts

Code: Select all

<table outputclass="value1 value2"/>
we would need to show a message that @outputclass="value1" is not allowed for table, and we need to give a quick fix to remove "value1" from @outputclass. We are now using the below snippet, where it completely removes the @outputclass attribute with the quick fix.

Code: Select all

   <pattern>
<rule id="a_1" context="*[contains(@class,' topic/table ')]">
<report test="(contains(@outputclass,'value1'))"
role="warning" sqf:fix="remove_value1">Insertion of @outputclass="value1" is not supported
here for <xsl:value-of select="local-name(.)"/>. </report>
<sqf:fix id="remove_value1">
<sqf:description><sqf:title>Remove outputclass=value1</sqf:title></sqf:description>
<sqf:delete match="@outputclass"></sqf:delete>
</sqf:fix>
</rule>
</pattern>

This is OK if user has defined only "value1" as a value. But if user defines "value2" also in the @outputclass, then it is not user friendly.

Can you suggest a way to remove only "value1" from @outputclass using quick fix instead of completely removing it if user gives multiple values in the @outputclass.

Thanks in advance!

Regards,
Shabeer

Re: Schematron Quick Fix to Remove Part of an Attribute Value!

Posted: Mon Dec 31, 2018 10:12 am
by Radu
Hi Shabeer,

Maybe you could use "sqf:replace". There is a sample Schematron with quick fixes in the Oxygen installation folder:

OXYGEN_INSTALL_DIR\samples\quick-fixes\flowers.sch

and it has a couple of "sqf:replace" usage samples.

Regards,
Radu

Re: Schematron Quick Fix to Remove Part of an Attribute Value!

Posted: Mon Dec 31, 2018 10:28 am
by mu258770
Hi Radu,

Thanks a lot for the reference!

It works now :)

Regards,
Shabeer