Modifying xhtml2xhtml.xsl

Here should go questions about transforming XML with XSLT and FOP.
Kae
Posts: 12
Joined: Tue Apr 01, 2014 9:39 am

Modifying xhtml2xhtml.xsl

Post by Kae » Tue Apr 01, 2014 12:40 pm

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.

sorin_ristache
Posts: 4144
Joined: Fri Mar 28, 2003 2:12 pm

Re: Modifying xhtml2xhtml.xsl

Post by sorin_ristache » Tue Apr 01, 2014 2:53 pm

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

Kae
Posts: 12
Joined: Tue Apr 01, 2014 9:39 am

Re: Modifying xhtml2xhtml.xsl

Post by Kae » Wed Apr 02, 2014 5:09 am

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.

sorin_ristache
Posts: 4144
Joined: Fri Mar 28, 2003 2:12 pm

Re: Modifying xhtml2xhtml.xsl

Post by sorin_ristache » Wed Apr 02, 2014 9:32 am

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

Kae
Posts: 12
Joined: Tue Apr 01, 2014 9:39 am

Re: Modifying xhtml2xhtml.xsl

Post by Kae » Wed Apr 02, 2014 10:22 am

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.

Post Reply