Camille B. wrote:

actually we need to keep the word style names as class attributes.
Others do not really interest us.

"role-*" class names are really required to generate any kind of semantic XML, including DocBook.




You will find a sample document attached, where we used the "heading2Column"
style to match double column sections in the document. If we can get
that style name back into the DocBook XML, we will be able to format the
XSL:FO accordingly. We would use the same trick for landscape sections
with style "Ttre1_paysage", and maybe other needs too.


Please find attached to this file 1) w2x option file custom_docbook5.txt

---
-o docbook5
-p edit.remove-styles.preserved-classes "p-heading2Column"
-t custom_docbook5.xslt
---

and 2) custom_docbook5.xslt

---
<xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
   xmlns:h="http://www.w3.org/1999/xhtml";
   xmlns:m="http://www.w3.org/1998/Math/MathML";
   xmlns="http://docbook.org/ns/docbook";
   exclude-result-prefixes="h m">

<xsl:import href="w2x:xslt/docbook5.xslt"/>

<xsl:template match="h:div[starts-with(@class, 'role-section')]/h:h2[contains(@class, 'p-heading2Column')]">
   <title>
     <xsl:call-template name="processCommonAttributes"/>
     <xsl:apply-templates/>
   </title>

   <info><orgname>ACME Corp.</orgname></info>
</xsl:template>

</xsl:stylesheet>
---

Please use attached files as follows:

---
w2x -f custom_docbook5.txt "mydoc.docx" out/out.xml
---
(This should also work fine with w2x-app and after updating your WEB-INF/web.xml, the W2X servlet.)




--> custom_docbook5.txt simply specifies that, in addition to role-* class names, "p-heading2Column" must be preserved.

Please feel free add more class names[*] to "edit.remove-styles.preserved-classes".

Documentation: http://www.xmlmind.com/w2x/_distrib/doc/manual/index.html#edit_step




--> custom_docbook5.xslt adds an <info> after the <title> of a section when the corresponding input HTML <div> starts with <h2 class="p-heading2Column">.

In order to write your actual custom_docbook5.xslt, please read the XSLT source of:

W2X_install_dir/xslt/docbook5.xslt



---
[*] If specifying HTML class *names* is not sufficient, we can send you a version of W2X_install_dir/xed/remove-styles.xed also accepting class *patterns*.

For example, something like

---
-p edit.remove-styles.preserved-classes "/^p-/"
---

This means: preserve all HTML class names starting with "p-".

Such enhanced "remove-styles.xed" will be anyway part of the next version of W2X.


-o docbook5
-p edit.remove-styles.preserved-classes "p-heading2Column"
-t custom_docbook5.xslt

Attachment: custom_docbook5.xslt
Description: application/xslt

--
XMLmind Word To XML Support List
w2x-support@xmlmind.com
http://www.xmlmind.com/mailman/listinfo/w2x-support

Reply via email to