Page 1 of 1

Modifying xhtml2xhtml.xsl

Posted: Tue Apr 01, 2014 12:40 pm
by Kae
Hello, I have read somewhere that in order to override the default Smart Paste behavior of the XML Editor, one has to modify this file. Does anyone have an example of a modified version of this file? I've been trying to modify this file, but my changes don't seem to be reflected in the editor at all.

i.e. I have the text "Test bold" with the following XML (this text was copy-pasted from MS Word 2003):

Code: Select all

<p xmlns="http://www.w3.org/1999/xhtml" class="MsoNormal"><b>Test</b><o:p xmlns:o="urn:schemas-microsoft-com:office:office"/></p>
My modification to the .xsl file is (just for testing purposes):

Code: Select all

<xsl:template match="p">
<b>Test</b>
</xsl:template>
<b>Test</b> should appear in the text editor when the said text is copy-pasted in Author Mode, but the modification doesn't seem to have any effect and it still displays the original XML.

Any help on the matter would be greatly appreciated.

Re: Modifying xhtml2xhtml.xsl

Posted: Tue Apr 01, 2014 2:53 pm
by sorin_ristache
Hello,

The modification will have an effect only in the XHTML editor panel because the xhtml2xhtml.xsl stylesheet is located in directory frameworks/xhtml/resources.

The element that comes from MS Word is <p xmlns="http://www.w3.org/1999/xhtml"> so you have to use a template like:

Code: Select all

<xsl:template match="xhtml:p" xmlns:xhtml="http://www.w3.org/1999/xhtml" mode="convert">

Regards,
Sorin

Re: Modifying xhtml2xhtml.xsl

Posted: Wed Apr 02, 2014 5:09 am
by Kae
That is noted. I have attempted it, though the formatting tags this time are stripped for some reason or the other. (i.e. the text loses its bold formatting when copy-pasted into the OxygenXML editor)

Is there any additional procedure needed to activate Smart Paste besides associating namespaces with xhtml? Thanks.

Re: Modifying xhtml2xhtml.xsl

Posted: Wed Apr 02, 2014 9:32 am
by sorin_ristache
Just make sure the xhtml2xhtml.xsl file exists in directory [Oxygen-install-dir]/frameworks/xhtml/resources and that you execute the Paste action in a file of type XHTML, for example the file was created by an action File -> New -> XHTML. Also make sure you did not disable by mistake the option Convert external content on paste from menu Options -> Preferences -> Editor / Edit modes / Author / Schema aware (by default it is enabled).

Please send us the source Word 2003 document and post here (or send us) the file xhtml2xhtml.xsl and the result that you get in Oxygen in the XHTML editor panel after the Paste action executed in Author editing mode. We need these details for investigating the problem.


Regards,
Sorin

Re: Modifying xhtml2xhtml.xsl

Posted: Wed Apr 02, 2014 10:22 am
by Kae
Never mind my last reply--it would seem that I mistakenly renamed xhtml2xhtml.xsl while tinkering with it. The modifications to xhtml2xhtml.xsl seem to work now. Thank you for the help and timely response.