Moving a list out of a paragraph, copyExceptClass not working?
Posted: Tue Jan 31, 2023 7:34 am
Hi,
I'm trying to move a list (ol or ul) out of a paragraph if it's found inside one.
The following Quick Fix works but the @class attribute is copied even if I have the mode="copyExceptClass" templates.
These templates are working fine in other fixes.
On strange thing I'm observing.
If I run the fix in Author mode, the ul and li have the class attribute copied. class="- topic/ul " and class="- topic/li "
If I run the fix in text mode, the xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/" is also copied on the ul element.
Any idea what I'm missing?
Regards,
Raymond
I'm trying to move a list (ol or ul) out of a paragraph if it's found inside one.
The following Quick Fix works but the @class attribute is copied even if I have the mode="copyExceptClass" templates.
These templates are working fine in other fixes.
Code: Select all
<pattern id="list_inside_paragraph">
<rule context="p">
<assert test="not(ol) and not(ul)" role="error" sqf:fix="moveListOutsideParagraph"> Une liste ne devrait pas être à l'intérieur d'un paragraphe. </assert>
<sqf:fix id="moveListOutsideParagraph">
<sqf:description>
<sqf:title>Déplacer la liste en dehors du paragraphe.</sqf:title>
</sqf:description>
<!-- copy the list after the paragraph -->
<sqf:add match="." position="after" select="ol | ul">
<xsl:apply-templates mode="copyExceptClass" select="ol | ul"/>
</sqf:add>
<!-- remove the list from the paragraph -->
<sqf:delete match="ol | ul"/>
</sqf:fix>
</rule>
<!-- Template used to copy the current node -->
<xsl:template match="node() | @*" mode="copyExceptClass">
<xsl:copy copy-namespaces="no">
<xsl:apply-templates select="node() | @*" mode="copyExceptClass"/>
</xsl:copy>
</xsl:template>
<!-- Template used to skip the @class attribute from being copied -->
<xsl:template match="@class" mode="copyExceptClass"/>
</pattern>
If I run the fix in Author mode, the ul and li have the class attribute copied. class="- topic/ul " and class="- topic/li "
If I run the fix in text mode, the xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/" is also copied on the ul element.
Any idea what I'm missing?
Regards,
Raymond