Fabián M. wrote:
could you please send us the XED script matching class patterns instead of names?
Please find the new "remove-styles.xed" attached to this email. Note that: 1) You'll have to add this line -pu edit.do.remove-styles remove-styles.xed to your custom_docbook5.txt to use the new "remove-styles.xed" 2) The pattern which matches all generated style names is: "^(t|(tr)|(tc)|(tp)|p|(pn)|n|c)-.+$" or equivalently: "/^(t|(tr)|(tc)|(tp)|p|(pn)|n|c)-.+$/"
(: : Copyright (c) 2017 XMLmind Software. All rights reserved. : : Author: Hussein Shafie : : This file is part of the XMLmind W2X project. : For conditions of distribution and use, see the accompanying legal.txt file. :) namespace "http://www.w3.org/1999/xhtml"; namespace html = "http://www.w3.org/1999/xhtml"; (: remove-styles.preserved-classes may contain regexp patterns but these patterns may not contain whitespace. Use '\s' to specify whitespace. :) set-variable("preservedClasses", if(defined("remove-styles.preserved-classes"), tokenize($remove-styles.preserved-classes, '\s+'), "")); (: Remove "s:rules" property from the document node. Document no longer has ``interned'' CSS rules. :) remove-rule(); (: * Remove "s:style" property from all elements. Elements no longer have ``interned'' CSS inline styles. However an element may have a "style" attribute added by one of the .xed scripts. * Remove all the classes added by the DOCX translator (e.g. "p-Normal") but not "role-XXX" classes from the "s:class" property of all elements. Note that, in addition an element may have a "class" attribute added by one of the .xed scripts. :) for-each /html/body//*[get-class() or style-count()] { if $preservedClasses { set-variable("styled", .); for-each $preservedClasses { set-variable("preservedClass", get-class(., $styled)); if $preservedClass { set-variable("classList", normalize-space($styled/@class)); if $classList = "" { set-variable("classList", $preservedClass); } elseif not(contains($classList, $preservedClass)) { set-variable("classList", concat($classList, " ", $preservedClass)); } set-attribute("class", $classList, $styled); } } } set-style(); remove-class("^(t|(tr)|(tc)|(tp)|p|(pn)|n|c)-.+$"); }
-o docbook5 -pu edit.do.remove-styles remove-styles.xed -p edit.remove-styles.preserved-classes "p-Titre2Col" -t custom_docbook5.xslt
custom_docbook5.xslt
Description: application/xslt
-- XMLmind Word To XML Support List w2x-support@xmlmind.com http://www.xmlmind.com/mailman/listinfo/w2x-support