Validating XSLT stylesheet with Java system-property

Here should go questions about transforming XML with XSLT and FOP.
tmakita
Posts: 100
Joined: Fri Apr 08, 2011 7:58 am

Validating XSLT stylesheet with Java system-property

Post by tmakita »

Hi!

I am developing multiple DITA-OT plug-ins for outputting PDF files.
Today I realized that there are templates that are used commonly in several plug-ins.
Most of the code are the same. However there are some interface changes between plug-ins.
I want to make a new common plug-in that have common templates for all plug-ins.
To do so I *MUST* write the following code in the common template.

Code: Select all

<xsl:variable name="isConditional" as="xs:boolean" select="ahf:isConditionalWoUkUs($row)" use-when="not(system-property('is.print.pdf') eq 'yes')"/>
<xsl:variable name="isConditional" as="xs:boolean" use-when="system-property('is.print.pdf') eq 'yes'">
<xsl:call-template name="ahf:isConditionalWoUkUs">
<xsl:with-param name="prmElem" select="$row"/>
</xsl:call-template>
</xsl:variable>
I do want to use the same calling interface for all plug-ins. But it is difficult because we must correct so many codes. So I decided to write as previous.

But oXygen reports validation error for one of above two instructions. I noticed that oXygen validation scenario cannot set the Java system-property.

Are there any solutions to validate this code normally?

If I invoke DITA-OT using this code setting Java sysproperty in ant build.xml, it finishes normally.

Code: Select all

<sysproperty key="is.print.pdf" value="yes"/>
Regards,
--
/*--------------------------------------------------
Toshihiko Makita
Development Group. Antenna House, Inc. Ina Branch
Web site:
http://www.antenna.co.jp/
http://www.antennahouse.com/
--------------------------------------------------*/
tmakita
Posts: 100
Joined: Fri Apr 08, 2011 7:58 am

Re: Validating XSLT stylesheet with Java system-property

Post by tmakita »

There is another situation that I need validation with Java system-property.

Code

Code: Select all


<xsl:variable name="makePageFn" as="xs:boolean" select="(string(@page-fn) eq $cYes) and $pSupportPageFn"/>
Import instruction

Code: Select all

<xsl:import href="dita2fo_pdf_html_review_alternate.xsl" use-when="system-property('is.print.pdf') eq 'yes'"/>
dita2fo_pdf_html_review_alternate.xsl

Code: Select all

<xsl:variable name="pSupportPageFn" as="xs:boolean" select="true()"/>
As I cannot set Java system-property oXygen mark the <variable name="makePageFn"> as error because $pSupportPageFn is not defined.

Hope this helps your understanding.
--
/*--------------------------------------------------
Toshihiko Makita
Development Group. Antenna House, Inc. Ina Branch
Web site:
http://www.antenna.co.jp/
http://www.antennahouse.com/
--------------------------------------------------*/
Radu
Posts: 9046
Joined: Fri Jul 09, 2004 5:18 pm

Re: Validating XSLT stylesheet with Java system-property

Post by Radu »

Hi,

I understand your problem.

Indeed in Oxygen when validating a certain XSLT document you can not specify that a certain system property should be set to a certain value for validation of a certain XSLT document.
Oxygen is a Java application and the validation is done in the same Java process which started Oxygen. So we cannot dynamically set system properties just for validation of a specific XSL because the system property would influence the entire application and all XSLT documents validated in it.

But it is possible to modify Oxygen's startup script to specify an extra system property using the construct -Dis.print.pdf=no which would apply in the entire Oxygen workspace for validating all opened XSLT documents.

The Oxygen startup scripts are located in:

http://www.oxygenxml.com/doc/ug-oxygen/ ... chers.html

When the DITA OT publishing is executed, it runs in its own Java process so it can have different system properties.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
tmakita
Posts: 100
Joined: Fri Apr 08, 2011 7:58 am

Re: Validating XSLT stylesheet with Java system-property

Post by tmakita »

Hi Radu,

Thank you for your explanation.
I will try changing oXygen startup script.

Regards,

--
/*--------------------------------------------------
Toshihiko Makita
Development Group. Antenna House, Inc. Ina Branch
E-Mail tmakita@antenna.co.jp
8077-1 Horikita Minamiminowa Vil. Kamiina Co.
Nagano Pref. 399-4511 Japan
Tel +81-265-76-9300 Fax +81-265-78-1668
Web site:
http://www.antenna.co.jp/
http://www.antennahouse.com/
--------------------------------------------------*/
--
/*--------------------------------------------------
Toshihiko Makita
Development Group. Antenna House, Inc. Ina Branch
Web site:
http://www.antenna.co.jp/
http://www.antennahouse.com/
--------------------------------------------------*/
Post Reply