[oXygen-user] Experimental XSLT for transforming oXygen change markup in DocBook docs into DocBook
Radu Coravu
support at oxygenxml.com
Mon Aug 17 23:46:33 CDT 2020
Hi Gerrit,
I'm glad you are interested in this aspect. There are 6 types of Oxygen
track changes:
https://www.oxygenxml.com/doc/versions/22.1/ug-editor/topics/track-changes-format.html
The insert track changes do not nest one in another, so you will never
have an insert track change inside another, same for the combination of
insert and delete track changes, they are not hierarchical, they are
intervals which do not intersect each other. So your XSLT should cover
most cases for insertions and deletions as oxy_insert_start and
oxy_insert_end processing instructions would usually be siblings
(surrounding wellformed XML content).
The surround change for example does not surround well formed XML
content, it just surrounds the start tag. The attribute change is just a
processing instruction before the XML start tag.
The comment and color highlights on the other side can nest one in
another and can intersect in any way. So these are nasty, you can create
elements for a comment start and end but you cannot create a wrapper
element over the entire content spanned by a comment or a color
highlight. You need some kind of a stack of processing instructions in
the XSLT to know where a comment starts and where it ends.
You can also reply to a change or to a comment in Oxygen and this will
generate extra comment changes which are threaded.
For DocBook 5 Oxygen ships with a bundled transformation scenario for
producing PDF with track changes, it's build file is located in:
OXYGEN_INSTALL_DIR/frameworks/docbook/xsl/fo-oxy-ct/build.xml
We also make available with an Apache 2.0 license the XSLT stylesheets
we use for DITA publishing, stylesheets which with small changes should
also work for DocBook HTML or PDF:
https://github.com/oxygenxml/dita-classic-pdf-review/tree/master/com.oxygenxml.pdf.review/review
From what I remember our way of handling this is to create from each
processing instruction start or end an equivalent XML element in a
custom Oxygen namespace, then to match all text() nodes, the template is
here:
https://github.com/oxygenxml/dita-classic-pdf-review/blob/master/com.oxygenxml.pdf.review/review/review-pis-to-elements-core.xsl
> <xsl:template match="text()" priority="100">
and if there are change elements which are around the text, surround
each text fragment in a highlight element. So we avoid surrounding
entire pieces of XML in annotation elements, we just surround each
individual piece of text.
Regards,
Radu
Radu Coravu
Oxygen XML Editor
On 8/17/20 10:21 PM, Imsieke, Gerrit, le-tex wrote:
> Apologies for cross-posting. Please think about whether the answer is
> most relevant to only one of both mailings lists before replying to both.
>
> I recently wanted to render a large book (DocBook 5.1) that was
> copy-edited in oXygen author mode and that contained the corresponding
> processing instructions, and I wanted to render it with the Ant-based
> FO scenario that displays changes. But for some reason that I could
> not really fathom, neither this FOP scenario nor the default PDF
> rendering scenario produced results, with different error messages.
> Increasing oXygen’s or Ant’s heap space to insane amounts didn’t
> improve the situation.
>
> Anyway, I didn’t need a PDF; HTML would be fine, too, so I decided to
> add an oXygen change markup renderer to Norm’s brand new xslTNG
> stylesheets, https://github.com/docbook/xslTNG
>
> There’s a pull request to xslTNG where I asked Norm to merge it into
> xslTNG (https://github.com/docbook/xslTNG/pull/67). But since it has
> been hardly tested on many documents, Norm is hesitant to merge it,
> and I’d like to collect some user feedback first.
>
> I’d like to ask you to test it on your DocBook files that have been
> enhanced with change markup in oXygen’s author mode. The patched
> renderer is at https://github.com/gimsieke/xslTNG/tree/oxy-markup. You
> probably need Gradle or something to build it yourself, but you can
> use the latest release (https://github.com/docbook/xslTNG/releases)
> and replace the changed files
> (https://github.com/docbook/xslTNG/pull/67/files).
>
> Or you can just run the stylesheet
> https://github.com/gimsieke/xslTNG/blob/oxy-markup/src/main/xslt/transforms/80-oxy-markup.xsl
> standalone, render the resulting DocBook to HTML and define the CSS
> classes .oxy_insert and .oxy_delete to naybe color:green and
> color:red, respectively.
>
> Please let me know whether it works in principle or whether there are
> bugs or missing features. Also whether there’s already another
> stylesheet somewhere in place that is supposed to render the oXygen
> change markup PIs.
>
> Gerrit
> _______________________________________________
> oXygen-user mailing list
> oXygen-user at oxygenxml.com
> https://www.oxygenxml.com/mailman/listinfo/oxygen-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.oxygenxml.com/pipermail/oxygen-user/attachments/20200818/315cde10/attachment.html>
More information about the oXygen-user
mailing list