Page 1 of 1

XSLT Extension to DITA-OT is not behaving as I believe it should

Posted: Tue Jan 24, 2012 6:48 pm
by mphare
I am using Oxygen XML Editor 13.2

First, I am crash coursing myself through DITA and specialization.

I have successfully created an extension to extend topic. I've deployed it to the Toolkit in Oxygen and I've run the XHTML transformation script and I get the results I expected.

Now, I want to create a transformation to do some formatting in the HTML output.

This looks dirt simple in the tutorial.
I created a directory: myTopicHTML
I created the transformation script, myTopic2HTML.xsl:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">

<xsl:template match="*[contains(@class, ' xml-d/xmlelem ')]" priority="10">
<xsl:text>XML: </xsl:text>
<xsl:apply-templates/>
<xsl:text> :XML</xsl:text>
</xsl:template>

</xsl:stylesheet>
I also created the plugin.xml in the same directory

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<plugin id="org.example.mytopic.html">
<require plugin="org.example.mytopic.doctypes"/>
<feature extension="dita.xsl.xhtml" value="myTopic2html.xsl"/>
</plugin>
org.example.mytopic.doctypes is the id I used when deploying the original element domain specialization.

I copied this directory (myTopicHTML) to the plugins directory of the Oxygen DITA-OT and ran the ant script: ant -f integrator.xml

It seems to run fine, but when I go to do my XHTML processing I get an error:
Fatal Error! I/O error reported by XML parser processing file:/myTopic2html.xsl: \myTopic2html.xsl (The system cannot find the file specified) Cause: java.io.FileNotFoundException: \myTopic2html.xsl (The system cannot find the file specified)
If I look in the catalog-dita.xml I see:

Code: Select all

<rewriteURI uriStartString="plugin:org.example.mytopic.html:"
rewritePrefix="plugins/myTopicHTML/"/>
Which would lead me to believe the toolkit is going to look inplugins/myTopicHTML for the XSLT script. (which is where it is)

So, why didn't it find my transformation script?
Does the integration update any other files? Where else can I look to resolve this problem?

Thanks,

Michael Hare

Re: XSLT Extension to DITA-OT is not behaving as I believe it should

Posted: Wed Jan 25, 2012 3:39 pm
by Radu
Hi Michael,

You have two problems, both in your plugin.xml.
1) The XSL is referenced with incorrect path capitalization, it's name is "myTopic2HTML.xsl" and it is referenced like "myTopic2html.xsl" which means that your specialization would not work correctly on Linux and Mac.

2) You need to specify 'type="file"' on the feature extension.

So the correct reference to the XSL should be like this:

Code: Select all

feature extension="dita.xsl.xhtml" value="myTopic2HTML.xsl" type="file"/>
After running the integrator, your XSL is added as an "xsl:import" to this XSL:

OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT/xsl/dita2html-base.xsl

You can also add some xsl:messages to your customized XSL and see if it gets called by searching for your messages in the console output.

Regards,
Radu

Re: XSLT Extension to DITA-OT is not behaving as I believe it should

Posted: Wed Jan 25, 2012 7:45 pm
by mphare
Hi Radu,

Excellent!

I completely overlooked the need for type="file" attribute and just didn't notice the incorrect case usage.

Problem solved!

Thanks,

- m