Copy resource files to output.dir for custom xhtml

Post here questions and problems related to editing and publishing DITA content.
shudson310
Posts: 156
Joined: Sat Feb 26, 2005 12:09 am
Location: USA
Contact:

Copy resource files to output.dir for custom xhtml

Post by shudson310 »

Hi,

I am creating a custom plugin based on the xhtml plugin. The transform appears to be working, but I cannot get the resource files from my plugin to copy over to the output directory. I'm using DITA-OT 2.2.2 and have it configured properly in oXygenXML 17.1 to use that toolkit.

Here's my plugin.xml:

Code: Select all

<plugin id="com.company.xhtml">
<feature extension="dita.xsl.xhtml" value="dita2custom.xsl" type="file"/>
<feature extension="dita.conductor.target.relative" file="conductor.xml"/>
</plugin>
My conductor.xml:

Code: Select all

<project name="com.company.custom.conductor">
<import file="build_dita2custom.xml"/>
</project>
My build file:

Code: Select all

<project xmlns:dita="http://dita-ot.sourceforge.net" name="dita2custom">

<property name="dita2custom.plugin.path" value="${dita.dir}/plugins/com.company.custom/"/>

<target name="dita2custom.init" depends="copyfiles">
<property name="html-version" value="xhtml"/>
</target>

<target name="dita2custom"
depends="dita2custom.init,
build-init,
preprocess,
xhtml.topics,
dita.map.xhtml">
</target>

<target name="copyfiles">
<!-- copy files -->
<copy todir="${output.dir}">
<fileset dir="${dita2custom.plugin.path}${file.separator}resource"/>
</copy>
</target>

</project>
What am I missing? I can't seem to get the files to copy from my plugin/resource directory to the output directory.

Thanks,

--Scott
Scott Hudson
Staff Content Engineer
Site: docs.servicenow.com
Radu
Posts: 9451
Joined: Fri Jul 09, 2004 5:18 pm

Re: Copy resource files to output.dir for custom xhtml

Post by Radu »

Hi Scott,

Maybe you could add some <echo>'s in the targets, see if they get called.
Also you seem to have defined a new transtype called custom.
Shouldn't you also have declared the transtype in your plugin.xml:

Code: Select all

<feature extension="dita.conductor.transtype.check" value="custom" type="txt"/>
and then set the transtype="custom" parameter when publishing?
Basically how this works is that based on the transtype parameter value, the DITA OT main build file prepends dita2 to it and then calls the target, namely in your case dita2custom.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
shudson310
Posts: 156
Joined: Sat Feb 26, 2005 12:09 am
Location: USA
Contact:

Re: Copy resource files to output.dir for custom xhtml

Post by shudson310 »

Thanks, Radu!

I modified slightly:

Code: Select all

<plugin id="custom">
<require plugin="org.dita.html5"/>
<feature extension="package.version" value="1.0.0"/>
<feature extension="dita.conductor.transtype.check" value="custom"/>
<feature extension="dita.xsl.xhtml" value="custom.xsl" type="file"/>
<feature extension="dita.conductor.target.relative" file="conductor.xml"/>

<!-- extensions -->
<transtype name="custom" extends="common-html" desc="HTML5">
<param name="nav-toc" type="enum" desc="Specifies whether to generate a navigation TOC in topic pages.">
<val default="true" desc="No TOC">none</val>
<val desc="Partial TOC that shows the current topic">partial</val>
<val desc="Full TOC">full</val>
</param>
</transtype>
</plugin>
and build.xml:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!-- This file is part of the DITA Open Toolkit project hosted on
Sourceforge.net. See the accompanying license.txt file for
applicable licenses.-->
<!-- (c) Copyright IBM Corp. 2006 All Rights Reserved. -->
<project xmlns:dita="http://dita-ot.sourceforge.net" name="custom" default="custom">

<property name="custom.plugin.path" value="${dita.dir}${file.separator}plugins${file.separator}com.jeppesen.slate${file.separator}"/>

<target name="custom.init">
<!--<property name="html-version" value="xhtml"/>-->
<property name="html-version" value="html5"/>
</target>

<!-- <target name="custom"
depends="custom.init,
build-init,
preprocess,
xhtml.topics,
dita.map.xhtml,
copyfiles">
</target>-->
<target name="custom"
depends="custom.init,
build-init,
preprocess,
dita2html5,
copyfiles">
</target>

<target name="copyfiles">
<!-- copy files -->
<!-- <copy todir="${dita.output.dir}">
<fileset dir="${custom.plugin.path}${file.separator}resource">
<include name="**/*" />
</fileset>
</copy>-->
<echo>Copying resource files...</echo>
<copy todir="c:\out\custom">
<fileset dir="${custom.plugin.path}${file.separator}resource">
<include name="**/*" />
</fileset>
</copy>
</target>

</project>
It works now, though I will try to use parameters rather than hard-code the path...
Scott Hudson
Staff Content Engineer
Site: docs.servicenow.com
Post Reply