Hello Jirka,
As usually default attributes appear on elements in the Schematron
schema and there is no way to know if they have been set in the schema
or directly on the XML element.
You can use a template to filter out the class attribute, something
similar to this older forum thread:
https://www.oxygenxml.com/forum/post54152.html#p54152
Regards,
Radu
Radu Coravu
Oxygen XML Editor
On 3/13/24 20:36, Jirka Kosek wrote:
Hi,
I'm creating few small "refactoring actions" using Schematron and
QuickFix for DITA in oXygen. It works except that default attributes
are being copied when some element is copied using QuickFix. For
example the following QuickFix
<sch:pattern>
<sch:rule context="p">
<sch:report test="image and
following-sibling::*[1]/self::fig[not(image)]"
sqf:fix="wrap-image">Image is misplaced and not
enclosed by a figure.</sch:report>
<sqf:fix id="wrap-image">
<sqf:description>
<sqf:title>Move image into adjacent figure.</sqf:title>
</sqf:description>
<sch:let name="image" value="image"/>
<sqf:delete/>
<sqf:add match="following-sibling::*[1]" position="last-child"
select="$image"/>
</sqf:fix>
</sch:rule>
</sch:pattern>
Will move image
<image href="media/image29.png"/>
as
<image class="- topic/image " href="media/image29.png"
placement="inline"
xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/"/>
I understand that this is perhaps because QuickFix is internally
implemented as XSLT transformation so default attributes are loaded
from DTD during the parsing. I can live with added @class and
@placement, but xmlns:ditaarch namespace declaration instantly
triggers validation error in oXygen which is inconvenient? Is this
something you can fix in next releases?
For now I've workaround that is using XSLT for performing QuickFix
action and uses <xsl:copy copy-namespaces="no"> and I intentionally do
not copy @class attribute. But QuickFix is much more concise.
Thanks and have a nice day,
Jirka
_______________________________________________
oXygen-user mailing list
oXygen-user@oxygenxml.com
https://www.oxygenxml.com/mailman/listinfo/oxygen-user
_______________________________________________
oXygen-user mailing list
oXygen-user@oxygenxml.com
https://www.oxygenxml.com/mailman/listinfo/oxygen-user