Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot set via "plugin.xml" system property to xslt task inside pipeline [DOT 2.0.1] #1859

Closed
raducoravu opened this issue Feb 23, 2015 · 8 comments
Labels
ant Plug-in configuration with Ant feature New feature or request priority/medium Medium (or unknown) priority issue stale No recent activity. May be closed soon.

Comments

@raducoravu
Copy link
Member

In my plugin.xml I add this:

<feature extension="dita.preprocess.mappull.param" file="mapPullParams.xml"/>

which points to an XML file containing this:

        <dummy>
            <sysproperty key="DOT_2" value="${DOT_2}"/>
        </dummy>

which means that the "build_preprocess.xml" will contain something like:

    <pipeline message="Pull the navtitle and topicmeta from topics to ditamap" taskname="mappull">
      <xslt basedir="${dita.temp.dir}" reloadstylesheet="${dita.preprocess.reloadstylesheet.mappull}" style="${dita.plugin.org.dita.base.dir}/xsl/preprocess/mappull.xsl">
        <includesfile name="${dita.temp.dir}/${fullditamapfile}"/>
        <param name="TRANSTYPE" expression="${transtype}"/>
        <param name="conserve-memory" expression="${conserve-memory}" if="conserve-memory"/>
        <sysproperty key="DOT_2" value="yes"/>
        <xmlcatalog refid="dita.catalog"/>
      </xslt>
    </pipeline>

and the publishing will fail like:

Caused by: class org.dita.dost.invoker.ExtensibleAntInvoker$Xslt doesn't support the nested "sysproperty" element.
at org.apache.tools.ant.IntrospectionHelper.throwNotSupported(IntrospectionHelper.java:509)
at org.apache.tools.ant.UnknownElement.handleChildren(UnknownElement.java:361)

although usually an XSLT ANT task can contain sysproperty items inside it.

What I am trying to do is to add some xsl-when conditions in the XSLT code in order to try and make a plugin work with both DITA OT 1.8 and 2.0.1.

@jelovirt
Copy link
Member

The <xslt> in mapull looks like Ant XSLT task, but it's actually not. It supports more or less the same elements as Ant XSLT, but it's part of <pipeline> element that is DITA-OT code.

@jelovirt jelovirt added feature New feature or request ant Plug-in configuration with Ant priority/medium Medium (or unknown) priority issue labels Feb 23, 2015
@raducoravu
Copy link
Member Author

I know but if it looks like a duck...
I'm trying to have some "use-when" conditions in an XSLT referenced using the "dita.xsl.mappull" from the plugin.xml just so that the XSLT can be used both with DOT 1.8 and 2.0.1.

@jelovirt
Copy link
Member

The problem I see with <sysproperty> is that it sets the system variable for the whole JVM(1). Since one of the goals in OT development is to be able to run multiple OT processes in parallel in a single JVM, this would go against it.

@jelovirt
Copy link
Member

The XsltModule could be refactored to use S9API instead of JAXP if S9API has a way to set variables for use-when?

@raducoravu
Copy link
Member Author

A use-when can also use the value of a static xsl param:

http://www.saxonica.com/html/documentation/xsl-elements/param.html

and it seems to be supported since Saxon 9.5. But it would mean that our plugin would not be able to run in a DITA OT which comes with Saxon 9.1.

Another option would be if the version of the DITA Open Toolkit would be available as a system property in the entire JVM. Unfortunately you cannot set in ANT a system property from the build file. Maybe set that version system property from one of the Java extensions and it will probably remain until the end specified in the JVM.

@stale
Copy link

stale bot commented Dec 12, 2018

This issue has been automatically marked as stale because it has not been updated recently. It will be closed soon if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale No recent activity. May be closed soon. label Dec 12, 2018
@stale stale bot closed this as completed Dec 26, 2018
@cinthyargc
Copy link

cinthyargc commented Mar 21, 2019

Hi @raducoravu, @jelovirt ,

Hope you are doing well...

I am running dita-ot 3.2.1 on a Mac system, and while creating a custom transformation that runs transform.topic2fo.main from pdf2 plug-in, I noticed that <xslt> tag is inside a <pipeline>, which is causing my transformation to fail:

org.dita.pdf2/build.xml:

<target name="transform.topic2fo.main">
...
<pipeline>
    <xslt style="${temp.transformation.file}" in="${dita.temp.dir}/stage1.xml" out="${dita.temp.dir}/stage2.fo">
    ...
<param name="dita.input.filename" expression="${dita.input.filename}" if="dita.input.filename"/>

  --> <sysproperty key="pdf.formatter" value="${pdf.formatter}"/>

      <xmlcatalog refid="xml.catalog"/>
    </xslt>
    </pipeline>
  </target>

Error message:

  [antcall] Exiting /.../dita-ot-3.2.1/build.xml.
  [antcall] Exiting /.../dita-ot-3.2.1/build.xml.
  [antcall] Exiting /.../dita-ot-3.2.1/build.xml.
Error: The following error occurred while executing this line:
/.../dita-ot-3.2.1/plugins/org.dita.pdf2/build.xml:151: The following error occurred while executing this line:
/.../dita-ot-3.2.1/plugins/org.dita.pdf2/build.xml:291: xslt doesn't support the nested "sysproperty" element.

Is there other work-around other than commenting out sysproperty line?
This is stopping me from transforming into PDF.

Thank you!

@cinthyargc
Copy link

@raducoravu, @jelovirt I have updated to latest version, 3.3, the issue sysproperty is gone, and I am able to run pdf transformation.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ant Plug-in configuration with Ant feature New feature or request priority/medium Medium (or unknown) priority issue stale No recent activity. May be closed soon.
Projects
None yet
Development

No branches or pull requests

3 participants