In dita-ot is it possible to integrate into a feature extension for a specific transtype only? - dita-ot

Specifically, I have a custom dita-ot xhtml plugin which uses the <feature extension="dita.xsl.xhtml" file="xsl/header.xsl"/> to integrate into the xhtml pipeline. But this extension is used by the default xhtml output as well. I don't want this. Is there a way to run my extensions only for my own plugin?
A small example (brandheader example from the dita-ot documentation) which demonstrates the described behavior:
plugin.xml:
<?xml version="1.0" encoding="UTF-8"?>
<plugin id="com.example.brandheader">
<feature extension="ant.import" file="build.xml" />
<feature extension="dita.xsl.xhtml" file="xsl/header.xsl"/>
<transtype name="xhtml-extension" />
</plugin>
build.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project name="com.example.xhtml.extension" basedir=".">
<target name="dita2xhtml-extension" depends="dita2xhtml"/>
</project>
header.xsl:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="gen-user-header">
<div>
<img src="https://www.dita-ot.org/images/dita-ot-logo.svg" alt="Example Company Banner"/>
</div>
</xsl:template>
</xsl:stylesheet>
The customized header appears for the xhtml transtype as well as for the xhtml-extension transtype.
I searched on stackoverflow for a similar question and I read the dita-ot developer documentation. But I couldn't find an option to enable the extension only for my plugin.
I am happy about any input.

Another option is to override the main XSLT used for processing in your custom XHTML plugin's build file:
<target name="dita2xhtml-custom"
depends="dita2xhtml-custom.init,
dita2xhtml"/>
<target name="dita2xhtml-custom.init">
<property name="args.xsl"
location="${dita.plugin.com.example.xhtml-custom.dir}/custom-main.xsl"/>
</target>
and your custom-main.xsl would import the xhtml XSLT stylesheet like:
<xsl:import href="plugin:org.dita.xhtml:xsl/dita2xhtml.xsl"/>
and add your own templates to the custom-main.xsl to override templates in the dita2xhtml.xsl.

Your "header.xsl" XSLT stylesheet will indeed be taken into account for any transformation type extended from the base XHTML one.
But what you could do would be to define in your plugin.xml an extension point with the name dita.conductor.xhtml.param:
https://www.dita-ot.org/dev/extension-points/all-extension-points.html#all-extension-points__dita.conductor.xhtml.param
Something like this:
<feature extension="dita.conductor.xhtml.param" value="params.xml" type="file"/>
and the params.xml file could contain:
Then in your XSLT stylesheet you define a global xsl:param named "TRANSTYPE" and you should receive on it the value of the transtype from the DITA OT build files, making it possible to take decisions in the custom XSLT templates based on the current transformation type.

Related

TestNG error in Eclipse

Getting attribute parallel with value none must have a value from the list "false methods tests class" error on my XML in Eclipse. I am stuck because of this error.
Please help.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite Name" parallel="none">
I did try changing value of parallel to "false", however issue still occurs.
Changed code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite Name" parallel="false">
See this, i dont have any issue
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" preserve-order="true" parallel="false">
<test name="Test1">
<classes>
<class name="com.test.Test1"/>
<class name="com.test.Test2"/>
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->
Just try by delete and typing again or you can use ctrl+space by typing few chars
Thank You,
Murali
Try with https, replacing "http://testng.org/testng-1.0.dtd" with "https://testng.org/testng-1.0.dtd"

GWT: CSS file defined in module definition file (gwt.xml) doesn't work?

From GWT tutorial (http://www.gwtproject.org/doc/latest/DevGuideUiCss.html), we know there are multiple approaches for associating CSS files with your module. Therein, one way is using the <stylesheet> element in the module XML file.
When I used the way to do it, I got the warning message below. It seems the way doesn't work.
Here's the contents of module1.gwt.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.7.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.7.0/distro-source/core/src/gwt-module.dtd">
<module rename-to="entry1">
<inherits name="com.google.gwt.user.User" />
<inherits name='com.google.gwt.user.theme.clean.Clean'/>
<source path="client" />
<entry-point class="com.jst.gwt2.client.Entry1"></entry-point>
<stylesheet src="../entry1.css" />
<source path='client' />
<source path='rpc' />
</module>
Here's the warning message:
GET /entry1.css
[WARN] ignored get request: /entry1.css
[WARN] not handled: /entry1.css
quoting #Thomas Broyer:
to get the full explanation click here
You'll have to change either
the path to your CSS (e.g. /entry1.css, but that won't necessarily work once deployed in production)
the location of your CSS (e.g. put it in your module's public path and reference it as <stylesheet src="entry1.css"/>)
the way you load it (e.g. inject it from your onModuleLoad, either as a StyleElement added to the Document; or possibly as a TextResource
that you inject using StyleInjector –and use one less request to the
server)

JCR Node imported as nt:file when using content-package-maven-plugin

I created an OSGI config JCR node in XML within my Adobe CQ project under /apps/myproject/config/org.apache.sling.commons.log.LogManager.factory.config-MYPROJECT.xml
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root
xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="sling:OsgiConfig"
org.apache.sling.commons.log.level="Trace"
org.apache.sling.commons.log.file="logs/myproject.log"
org.apache.sling.commons.log.file.number="5"
org.apache.sling.commons.log.file.size="5MB"
org.apache.sling.commons.log.pattern="\{0,date,HH:mm:ss.SSS} *{4}* {3} {5}"
org.apache.sling.commons.log.names="[com.mycompany.myproject]" />
Problem is that when it gets imported into the JCR, it is showing up as an nt:file instead of what it should be according to its jcr:primaryType so that it look like this in CRXDE
when it should look like this
So my XML markup starts EXACTLY as follows:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root
xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
...
What I had done originally was to create a new xml file and put in my config. There are 2 other ways I know to create nodes
By doing it in CRXDE and then using vault to export
By doing it in Eclipse using the AEM developer tools (Eclipse plugin for Apache Sling)
In the case of a vault export, the XML starts like this:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" ...
and in the case of the plugin, it starts like this
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root
xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
...
but wait, you can't see it here, the plugin actually adds a friggin blank space right after jcr:root.
So whatever XML parser is acting on these XML files to create nodes in the JRC, it behaves oddly if there is no space right after the root node name. I'm on Windows, using Maven 3.2.3, using version 0.0.20 of content-package-maven-plugin, and AEM 5.6.1.
Please check your filter definition of the content-package-maven-plugin. If your filter root is set to
<filter>
<root>
/apps/myproject/config/org.apache.sling.commons.log.LogManager.factory.config-MYPROJECT.xml
</root>
</filter>
instead of
<filter>
<root>
/apps/myproject/config/org.apache.sling.commons.log.LogManager.factory.config-MYPROJECT
</root>
</filter>
then it will likely just put the file into your repository instead of creating the configuration node.
The latter one without .xml file extension is correct.
You need to add jcr:mixinTypes="[]" type as a property to your logger. So Your configuration will be like :
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:mixinTypes="[]"
jcr:primaryType="sling:OsgiConfig"
org.apache.sling.commons.log.level="Trace"
org.apache.sling.commons.log.file="logs/myproject.log"
org.apache.sling.commons.log.file.number="5"
org.apache.sling.commons.log.file.size="5MB"
org.apache.sling.commons.log.pattern="\{0,date,HH:mm:ss.SSS} *{4}* {3} {5}"
org.apache.sling.commons.log.names="[com.mycompany.myproject]" />
Hope this will help.

What are the steps needed in DITA-OT to pass ANT command line parameters to custom plugin's override XSLT-script

This question follows this: Is it possible to pass custom ANT parameters into custom plugin with DITA-OT?
I have plugin folder called: com.mymods.pdf under DITA-OT/plugins folder. Under is explained the structure and files shortly (follows this example closely http://dita-ot.github.io/1.8/readme/dita2pdf-customization.html). Plugin works but now I want to pass ANT command line parameters into mycustom.xsl:
com.mymods.pdf/
cfg/
common/
vars/
en.xml
fo/
attrs/
mycustom.xsl
xsl/
mycustom.xsl
catalog.xml
integrator.xml
plugin.xml
build_mymods_pdf_template.xml (dita2com.mymods.pdf.init target is here and it depends on dita2pdf2)
build.xml (<project><import file="build_mymods_pdf.xml"/></project>)
insertParameters.xml (see the linked question for contents)
So where I need to apply changes and/or add new files?
I use the plugin from other location with "mainANT.xml" which has target and transtype for using "dita2mymodsPDF".
plugin.xml code:
<?xml version='1.0' encoding='UTF-8'?>
<plugin id="com.mymods.pdf">
<require plugin="org.dita.pdf2" />
<feature extension="dita.conductor.transtype.check" value="com.mymods.pdf" />
<feature extension="dita.transtype.print" value="com.mymods.pdf" />
<feature extension="dita.conductor.target.relative" file="integrator.xml" />
<feature extension="dita.conductor.com.mymods.pdf.param" file="insertParameters.xml"/>
<extension-point id="dita.conductor.com.mymods.pdf.param" name="PDF XSLT parameters"/>
</plugin>
build_mymods_pdf_template.xml code:
<?xml version='1.0' encoding='UTF-8'?>
<project name="com.mymods.pdf" default="com.mymods.pdf">
<property name="transtype" value="com.mymods.pdf"/>
<target name="dita2com.mymods.pdf.init">
<property location="${dita.plugin.com.mymods.pdf.dir}/cfg" name="customization.dir" />
<property location="${dita.plugin.com.mymods.pdf.dir}/xsl/fo/topic2fo_shell_fop.xsl" name="args.xsl.pdf" />
<property name="args.chapter.layout" value="BASIC" />
<property name="args.bookmark.style" value="COLLAPSED" />
<!--property name="args.fo.include.rellinks" value="nofamily" /-->
</target>
<target depends="dita2com.mymods.pdf.init, dita2pdf2" name="dita2com.mymods.pdf" />
</project>
Also integrator.xml code:
<?xml version='1.0' encoding='UTF-8'?>
<project name="com.mymods.pdf">
<target name="dita2com.mymods.pdf.init">
<property location="${dita.plugin.com.mymods.pdf.dir}/cfg" name="customization.dir" />
<property location="${dita.plugin.com.mymods.pdf.dir}/xsl/fo/topic2fo_shell_fop.xsl" name="args.xsl.pdf" />
<property name="args.chapter.layout" value="BASIC" />
<property name="args.bookmark.style" value="COLLAPSED" />
<!--property name="args.fo.include.rellinks" value="nofamily" /-->
</target>
<target depends="dita2com.mymods.pdf.init, dita2pdf2" name="dita2com.mymods.pdf" />
</project>
Not totally sure whether integrator.xml or build_mymods_pdf_template.xml is like it actually should. But this fileset works and uses mycustom.xsl (other for attributes and other for XSLT overrides). Now the problem is that how to get my own custom ANT parameters so the plugin can see its value.
This is really easy for pdf2 plugin but still can't yet get it working inside my com.mymods.pdf . I think I don't need to post catalog.xml because it just tells where are "mycustom.xsl" files that are working properly.
Really easy way, not the cleanest way to do this is:
Note: This applies for DITA-OT 1.8.4 check suitability for other versions.
Create your custom PDF plugin as told in: http://dita-ot.github.io/1.8/readme/dita2pdf-customization.html
Create "insertParameters.xml" as in: http://dita-ot.github.io/1.8/dev_ref/plugin-xsltparams.html
In my case with following custom parameters:
<?xml version='1.0' encoding='UTF-8'?>
<dummy>
<!-- EXAMPLE: <param name="paramNameinXSLT" expression="${antProperty}" if="antProperty"/> -->
<param name="custom.data1" expression="${custom.data1}" if="custom.data1"/>
<param name="custom.data2" expression="${custom.data2}" if="custom.data2"/>
</dummy>
Now drop this "insertParameters.xml" into DITA-OT\plugins\org.dita.pdf2
Create processing to custom.xsl under xsl\custom.xsl.
Here is an example code snippet for custom.xsl
<?xml version='1.0' encoding='UTF-8'?>
<snippet>
<xsl:param name="custom.data1"/>
<xsl:param name="custom.data2"/>
<fo:block><xsl:value-of select="$custom.data1"/></fo:block>
<fo:block><xsl:value-of select="$custom.data2"/></fo:block>
</snippet>
Run integrator.xml to integrate changes into your DITA-OT.
Give in command line commands for running your PDF scenario like: "ant dita2mypdf -f -Dcustom.data1="myCustomParameter1value" -Dcustom.data2="myCustomParameter2value"
Run the process to create PDF and your parameters should be visible!
What this question was really intended to achieve to get a step by step instruction to set all these things to work 100% in the custom plugin that not a single thing needs to be added into DITA-OT default plugins (not even single file into pdf2 folder as in this solution). This could make updating DITA-OT remarkably easier for future.
The cleaner? alternative to this approach is
add a placeholder insertParameters.xml to the root of the DITA-OT 1.8.5. The file does not exist in the standard DITA-OT 1.8.5
<?xml version='1.0' encoding='UTF-8'?>
<dummy>
<param name="dummy" expression="{$dummy} if="dummy"/>
</dummy>
add the override insertParameters.xml to the root of your plugin
<?xml version='1.0' encoding='UTF-8'?>
<dummy>
<param name="my.runtime.parameter" expression="{$my.runtime.parameter} if="my.runtime.parameter"/>
</dummy>
Then run ant -f integrator.xml
Without knowing precisely which parameters you need to pass, it's difficult to answer this question. However, let's assume you're invoking this from the command line and you've defined a transtype of mymodspdf. The command would look like this:
ant -f build.xml -Dtranstype mymodspdf -Dmyparameter1 paramval1 -Dmyparameter2 paramval2
HTH,
Julio J. Vazquez
Write Spirit
http://www.writespiritservices.com

Setting -XdisableCastChecking to true

I need to set -XdisableCastChecking to true for building a GWT application (with Eclipse).
I know how to do it to compile the application but I'm not able to set -XdisableCastChecking to true for building the war file (I'm using a build.xml and file).
Does anybody know how to include this flag into the ant file?
Thank you in advance.
Alsila
If you are using a standard build.xml generated with the wepAppCreator, you should have at the top of your build.xml something like the block below. Modify the gwt.args line adding the arguments you want to pass to the gwt compiler:
<?xml version="1.0" encoding="utf-8" ?>
<project name="myproject" default="build" basedir=".">
<!-- Arguments to gwtc and devmode targets -->
<property name="gwt.args" value="-XdisableCastChecking" />
[...]