Moving a list out of a paragraph, copyExceptClass not working?
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 31
- Joined: Sat Jan 17, 2015 6:21 pm
Moving a list out of a paragraph, copyExceptClass not working?
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
-
- Posts: 388
- Joined: Thu Jul 01, 2004 12:29 pm
Re: Moving a list out of a paragraph, copyExceptClass not working?
Hi Raymond,
The quick fix that you created contains in the "sqf:add" operation both the xsl:apply-templates mode="copyExceptClass" and select="ol | ul". You need to use only the xsl:apply-templates mode="copyExceptClass" in the cotent of the "sqf:add" operation. Something like this:
Best Regards,
Octavian
The quick fix that you created contains in the "sqf:add" operation both the xsl:apply-templates mode="copyExceptClass" and select="ol | ul". You need to use only the xsl:apply-templates mode="copyExceptClass" in the cotent of the "sqf:add" operation. Something like this:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2"
xmlns:sqf="http://www.schematron-quickfix.com/validator/process" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<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">
<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>
</schema>
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “SDK-API, Frameworks - Document Types”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service