Skip to content
This repository has been archived by the owner on Jul 5, 2019. It is now read-only.

Commit

Permalink
Works with DITA OT 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
raducoravu committed Jul 5, 2019
1 parent d863023 commit 09eb49b
Show file tree
Hide file tree
Showing 21 changed files with 136 additions and 62 deletions.
10 changes: 6 additions & 4 deletions com.oxygenxml.pdf.css/build-merged2html5.xml
Expand Up @@ -11,15 +11,17 @@ Applies the XSL transformation to get html5 from the merged map.
<!-- Figure title placement. May come as argument. -->
<property name="figure.title.placement" value="top"/>

<pipeline message="Process the merged map to html5" taskname="m2h">
<xslt in="${mh5.dita.file}" out="${mh5.html.file}" style="${mh5.xsl.file}">
<xmlcatalog>
<catalogpath path="${xsl.extensions.xml.catalog.file.path}"/>
</xmlcatalog>
<xmlcatalog refid="dita.catalog"/>
<xmlcatalog>
<catalogpath path="${xsl.extensions.xml.catalog.file.path}"/>
<catalogpath path="${dita.plugin.org.dita.base.dir}/catalog-dita.xml"/>
</xmlcatalog>
<param name="html5.css.links" expression="${html5.css.links}"/>
<param name="figure.title.placement" expression="${figure.title.placement}"/>

</xslt>
</pipeline>

<copy xmlns:dita="http://dita-ot.sourceforge.net" file="${mh5.html.file}" tofile="${dita.map.output.dir}/${dita.map.filename.root}.merged.html" force="true"/>
</target>
Expand Down
10 changes: 6 additions & 4 deletions com.oxygenxml.pdf.css/build-merged2html5_template.xml
Expand Up @@ -13,15 +13,17 @@ Applies the XSL transformation to get html5 from the merged map.
<!-- Figure title placement. May come as argument. -->
<property name="figure.title.placement" value="top"/>

<pipeline message="Process the merged map to html5" taskname="m2h">
<xslt in="${mh5.dita.file}" out="${mh5.html.file}" style="${mh5.xsl.file}">
<xmlcatalog>
<catalogpath path="${xsl.extensions.xml.catalog.file.path}"/>
</xmlcatalog>
<xmlcatalog refid="dita.catalog"/>
<xmlcatalog>
<catalogpath path="${xsl.extensions.xml.catalog.file.path}" />
<catalogpath path="${dita.plugin.org.dita.base.dir}/catalog-dita.xml"/>
</xmlcatalog>
<param name="html5.css.links" expression="${html5.css.links}"/>
<param name="figure.title.placement" expression="${figure.title.placement}"/>
<dita:extension id="com.oxygenxml.pdf.css.xsl.merged2html5.parameters" behavior="org.dita.dost.platform.InsertAction" xmlns:dita="http://dita-ot.sourceforge.net"/>
</xslt>
</pipeline>

<copy
file="${mh5.html.file}"
Expand Down
12 changes: 3 additions & 9 deletions com.oxygenxml.pdf.css/build-merged2merged.xml
Expand Up @@ -22,20 +22,13 @@ Applies the XSL transformation to get html5 from the merged map.
<!-- Figure title placement. May come as argument. -->
<property name="figure.title.placement" value="top"/>


<xslt in="${dita.map.merged}" out="${dita.map.merged.post.processed}" style="${dita.plugin.com.oxygenxml.pdf.css.dir}/xsl/merged2merged/merged.xsl" force="true" classpath="${dita.plugin.com.oxygenxml.pdf.css.dir}/xsl/merged2merged/java">
<pipeline message="Process the merged map" taskname="m2m">
<xslt in="${dita.map.merged}" out="${dita.map.merged.post.processed}" style="${dita.plugin.com.oxygenxml.pdf.css.dir}/xsl/merged2merged/merged.xsl">
<xmlcatalog>
<catalogpath path="${xsl.extensions.xml.catalog.file.path}"/>
</xmlcatalog>


<factory name="net.sf.saxon.TransformerFactoryImpl">
<!--
Avoid saxon:assign warnings. For newer Saxon libraries the next property should be set:
<attribute name="http://saxon.sf.net/feature/allow-multithreading" value="false"/>
-->
</factory>

<param name="args.draft" expression="${args.draft}"/>
<param name="input.dir.url" expression="${user.input.dir.url}"/>
<param name="show.changes.and.comments" expression="${show.changes.and.comments}"/>
Expand All @@ -46,6 +39,7 @@ Applies the XSL transformation to get html5 from the merged map.


</xslt>
</pipeline>
</target>

</project>
12 changes: 3 additions & 9 deletions com.oxygenxml.pdf.css/build-merged2merged_template.xml
Expand Up @@ -24,20 +24,13 @@ Applies the XSL transformation to get html5 from the merged map.
<!-- Figure title placement. May come as argument. -->
<property name="figure.title.placement" value="top"/>


<xslt in="${dita.map.merged}" out="${dita.map.merged.post.processed}" style="${dita.plugin.com.oxygenxml.pdf.css.dir}/xsl/merged2merged/merged.xsl" force="true" classpath="${dita.plugin.com.oxygenxml.pdf.css.dir}/xsl/merged2merged/java">
<pipeline message="Process the merged map" taskname="m2m">
<xslt in="${dita.map.merged}" out="${dita.map.merged.post.processed}" style="${dita.plugin.com.oxygenxml.pdf.css.dir}/xsl/merged2merged/merged.xsl">
<xmlcatalog>
<catalogpath path="${xsl.extensions.xml.catalog.file.path}"/>
</xmlcatalog>


<factory name="net.sf.saxon.TransformerFactoryImpl">
<!--
Avoid saxon:assign warnings. For newer Saxon libraries the next property should be set:
<attribute name="http://saxon.sf.net/feature/allow-multithreading" value="false"/>
-->
</factory>

<param name="args.draft" expression="${args.draft}" />
<param name="input.dir.url" expression="${user.input.dir.url}" />
<param name="show.changes.and.comments" expression="${show.changes.and.comments}" />
Expand All @@ -48,6 +41,7 @@ Applies the XSL transformation to get html5 from the merged map.
<dita:extension id="com.oxygenxml.pdf.css.xsl.merged2merged.parameters" behavior="org.dita.dost.platform.InsertAction" xmlns:dita="http://dita-ot.sourceforge.net" />

</xslt>
</pipeline>
</target>

</project>
Binary file not shown.
1 change: 1 addition & 0 deletions com.oxygenxml.pdf.css/plugin.xml
Expand Up @@ -15,6 +15,7 @@

<extension-point id="com.oxygenxml.pdf.css.xsl.merged2merged.parameters" name="Extension point to pass parameters for the XSLT post-processing of the merged DITA map before other stages."/>
<extension-point id="com.oxygenxml.pdf.css.xsl.merged2merged" name="XSLT extension point for post-processing the merged DITA map before other stages."/>
<feature extension="dita.conductor.lib.import" file="lib/oxygen-dita-publishing-xslt-extensions.jar" xml:base="."/>

<template file="xsl/merged2html5/html5_template.xsl"/>
<template file="xsl/merged2merged/merged_template.xsl"/>
Expand Down
2 changes: 1 addition & 1 deletion com.oxygenxml.pdf.css/xsl/merged2merged/merged-all.xsl
Expand Up @@ -5,7 +5,7 @@
xmlns:oxy="http://www.oxygenxml.com/extensions/author"
xmlns:saxon="http://saxon.sf.net/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ImageInfo="java:ImageInfo" exclude-result-prefixes="#all">
xmlns:ImageInfo="java:com.oxygenxml.dita.xsltextensions.ImageInfo" exclude-result-prefixes="#all">

<xsl:param name="args.draft" select="'no'"/>
<xsl:param name="input.dir.url"/>
Expand Down
Expand Up @@ -13,7 +13,7 @@
xmlns:oxy="http://www.oxygenxml.com/extensions/author"
xmlns:saxon="http://saxon.sf.net/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ImageInfo="java:ImageInfo" exclude-result-prefixes="#all">
xmlns:ImageInfo="java:com.oxygenxml.dita.xsltextensions.ImageInfo" exclude-result-prefixes="#all">


<!--
Expand Down
Expand Up @@ -5,7 +5,7 @@
xmlns:oxy="http://www.oxygenxml.com/extensions/author"
xmlns:saxon="http://saxon.sf.net/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ImageInfo="java:ImageInfo" exclude-result-prefixes="#all">
xmlns:ImageInfo="java:com.oxygenxml.dita.xsltextensions.ImageInfo" exclude-result-prefixes="#all">

<!-- This is moved in the root. -->
<xsl:template match="opentopic:map/*[contains(@class, ' map/topicmeta ')]"/>
Expand Down
Expand Up @@ -5,7 +5,7 @@
xmlns:oxy="http://www.oxygenxml.com/extensions/author"
xmlns:saxon="http://saxon.sf.net/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ImageInfo="java:ImageInfo" exclude-result-prefixes="#all">
xmlns:ImageInfo="java:com.oxygenxml.dita.xsltextensions.ImageInfo" exclude-result-prefixes="#all">
<!-- Hides or shows the draft comments depending on the DITA-OT args.draft parameter. -->
<xsl:template match="*[contains(@class, ' topic/draft-comment ')] | *[contains(@class, ' topic/required-cleanup ')] ">
<xsl:if test="$args.draft = 'yes'">
Expand Down
Expand Up @@ -5,7 +5,7 @@
xmlns:oxy="http://www.oxygenxml.com/extensions/author"
xmlns:saxon="http://saxon.sf.net/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ImageInfo="java:ImageInfo" exclude-result-prefixes="#all">
xmlns:ImageInfo="java:com.oxygenxml.dita.xsltextensions.ImageInfo" exclude-result-prefixes="#all">
<!--
General filtering.
Expand Down
Expand Up @@ -5,7 +5,7 @@
xmlns:oxy="http://www.oxygenxml.com/extensions/author"
xmlns:saxon="http://saxon.sf.net/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ImageInfo="java:ImageInfo" exclude-result-prefixes="#all">
xmlns:ImageInfo="java:com.oxygenxml.dita.xsltextensions.ImageInfo" exclude-result-prefixes="#all">
<!--
Bookmap: Frontmatter and Backmatter
Expand Down
2 changes: 1 addition & 1 deletion com.oxygenxml.pdf.css/xsl/merged2merged/merged-images.xsl
Expand Up @@ -5,7 +5,7 @@
xmlns:oxy="http://www.oxygenxml.com/extensions/author"
xmlns:saxon="http://saxon.sf.net/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ImageInfo="java:ImageInfo" exclude-result-prefixes="#all">
xmlns:ImageInfo="java:com.oxygenxml.dita.xsltextensions.ImageInfo" exclude-result-prefixes="#all">
<!--
Images.
Expand Down
21 changes: 21 additions & 0 deletions com.oxygenxml.pdf.css/xsl/review/review-dita-id-filter.xsl
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs saxon oxy" version="2.0"
xmlns:oxy="http://www.oxygenxml.com/extensions/author" xmlns:saxon="http://saxon.sf.net/" xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/" extension-element-prefixes="saxon">



<xsl:function name="oxy:getOriginalDITAIDValue" as="item()*">
<xsl:param name="currentValue" />

<xsl:analyze-string regex="^unique_(\d+)_Connect_(\d+)_(.*?)$" select="$currentValue">
<xsl:matching-substring>
<xsl:value-of select="regex-group(3)" />
</xsl:matching-substring>
<xsl:non-matching-substring>
<xsl:value-of select="$currentValue" />
</xsl:non-matching-substring>
</xsl:analyze-string>

</xsl:function>

</xsl:stylesheet>
31 changes: 28 additions & 3 deletions com.oxygenxml.pdf.css/xsl/review/review-elements-to-fo.xsl
Expand Up @@ -258,15 +258,40 @@
<xsl:apply-templates select="node()[not(namespace-uri() = 'http://www.oxygenxml.com/extensions/author')] | @*"/>
</xsl:copy>
</xsl:template>

<xsl:function name="oxy:getFoElemIndex" as="xs:integer">
<xsl:param name="currentElem"/>
<xsl:value-of select="$currentElem/count(preceding-sibling::fo:*)"/>
</xsl:function>

<xsl:template match="*:cell">
<xsl:template match="*:table-cell">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<!-- Copy also change tracking information located before the cell. -->
<xsl:apply-templates select="preceding-sibling::node()[namespace-uri() = 'http://www.oxygenxml.com/extensions/author']"/>
<xsl:variable name="thisCellIndex" select="oxy:getFoElemIndex(.)"/>
<xsl:variable name="ctBefore">
<xsl:apply-templates
select="preceding-sibling::*[not(local-name() = 'oxy-range-end')]
[namespace-uri() = 'http://www.oxygenxml.com/extensions/author']
[oxy:getFoElemIndex((following-sibling::fo:*)[1]) = $thisCellIndex]"/>
</xsl:variable>
<xsl:if test="not(empty($ctBefore)) and not($ctBefore = '')">
<fo:block>
<xsl:copy-of select="$ctBefore"/>
</fo:block>
</xsl:if>
<xsl:apply-templates select="node()"/>
<!-- Copy also change tracking information located after the cell. -->
<xsl:apply-templates select="following-sibling::node()[namespace-uri() = 'http://www.oxygenxml.com/extensions/author']"/>
<xsl:variable name="ctAfter">
<xsl:apply-templates select="following-sibling::*[local-name() = 'oxy-range-end']
[namespace-uri() = 'http://www.oxygenxml.com/extensions/author']
[oxy:getFoElemIndex((preceding-sibling::fo:*)[last()]) = $thisCellIndex]"/>
</xsl:variable>
<xsl:if test="not(empty($ctAfter)) and not($ctAfter = '')">
<fo:block>
<xsl:copy-of select="$ctAfter"/>
</fo:block>
</xsl:if>
</xsl:copy>
</xsl:template>

Expand Down
7 changes: 3 additions & 4 deletions com.oxygenxml.pdf.css/xsl/review/review-elements-to-html.xsl
Expand Up @@ -2,7 +2,7 @@
<!--
Oxygen WebHelp Plugin
Copyright (c) 1998-2018 Syncro Soft SRL, Romania. All rights reserved.
Copyright (c) 1998-2019 Syncro Soft SRL, Romania. All rights reserved.
-->
<!--
Expand Down Expand Up @@ -44,8 +44,7 @@ Copyright (c) 1998-2018 Syncro Soft SRL, Romania. All rights reserved.
</span>
</xsl:template>


<xsl:template match="oxy:*" >
<xsl:template match="oxy:oxy-comment|oxy:oxy-delete|oxy:oxy-insert|oxy:oxy-attributes">
<span>
<xsl:call-template name="attributes"/>

Expand All @@ -68,7 +67,7 @@ Copyright (c) 1998-2018 Syncro Soft SRL, Romania. All rights reserved.
</xsl:template>


<xsl:template match="oxy:*/oxy:*" >
<xsl:template match="oxy:oxy-comment//oxy:*|oxy:oxy-delete//oxy:*|oxy:oxy-insert//oxy:*|oxy:oxy-attributes//oxy:*">
<!-- Reply to comment. Avoid generating links. -->
<span>
<xsl:attribute name="class" select="local-name()"/>
Expand Down
2 changes: 1 addition & 1 deletion com.oxygenxml.pdf.css/xsl/review/review-group-replies.xsl
Expand Up @@ -2,7 +2,7 @@
<!--
Oxygen WebHelp Plugin
Copyright (c) 1998-2018 Syncro Soft SRL, Romania. All rights reserved.
Copyright (c) 1998-2019 Syncro Soft SRL, Romania. All rights reserved.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
Expand Down
Expand Up @@ -2,7 +2,7 @@
<!--
Oxygen WebHelp Plugin
Copyright (c) 1998-2018 Syncro Soft SRL, Romania. All rights reserved.
Copyright (c) 1998-2019 Syncro Soft SRL, Romania. All rights reserved.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
Expand Down
Expand Up @@ -2,7 +2,7 @@
<!--
Oxygen WebHelp Plugin
Copyright (c) 1998-2018 Syncro Soft SRL, Romania. All rights reserved.
Copyright (c) 1998-2019 Syncro Soft SRL, Romania. All rights reserved.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
Expand Down
10 changes: 9 additions & 1 deletion com.oxygenxml.pdf.css/xsl/review/review-pis-to-elements.xsl
Expand Up @@ -2,7 +2,7 @@
<!--
Oxygen WebHelp Plugin
Copyright (c) 1998-2018 Syncro Soft SRL, Romania. All rights reserved.
Copyright (c) 1998-2019 Syncro Soft SRL, Romania. All rights reserved.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
Expand All @@ -28,6 +28,8 @@ Copyright (c) 1998-2018 Syncro Soft SRL, Romania. All rights reserved.
-->
<xsl:template match="/*">
<xsl:copy>
<xsl:call-template name="add-namespace-declarations"/>

<xsl:apply-templates select="@*"/>

<xsl:call-template name="add-review-pis-for-root"/>
Expand All @@ -45,5 +47,11 @@ Copyright (c) 1998-2018 Syncro Soft SRL, Romania. All rights reserved.
<xsl:apply-templates select="preceding-sibling::processing-instruction('oxy_attributes')" mode="processOxygenPIs"/>
</xsl:template>

<!--
Give a chance to the importing stylesheets to add prefix - namespace
mappings on the root of the document.
-->
<xsl:template name="add-namespace-declarations"/>


</xsl:stylesheet>

0 comments on commit 09eb49b

Please sign in to comment.