Page 1 of 1

Json transformation fails due to default xsl files

Posted: Wed Nov 18, 2020 9:34 pm
by Jesse
Hello,

I am trying to publish the topics in my ditamap to a single xml or json file to be used by a help gadget that is embedded in the product. The file will contain topics that each have unique reference IDs which are used to created context-sensitive tool tips.

Anyway, I have created a new transformation DITA-OT json transformation scenario using the stock settings, but keep getting the following fatal errors:

Code: Select all

System ID: C:\Program Files\Oxygen XML Editor 20\frameworks\dita\DITA-OT2.x\plugins\org.dita-community.common.xslt\xsl\dita-support-lib.xsl
Scenario: OxygenIntro (json)
Input file: C:\dita-tech-enablement\Oxygen-training\Class-files\5-8-2020\Jesse\OxygenIntro.ditamap
Engine name: XSLT
Severity: fatal
Description: Required item type of first argument of matches() is xs:string; supplied value has item type xs:boolean
Start location: 40:5

System ID: C:\Program Files\Oxygen XML Editor 20\frameworks\dita\DITA-OT2.x\plugins\org.dita4publishers.common.xslt\xsl\map2graphicMap.xsl
Scenario: OxygenIntro (json)
Input file: C:\dita-tech-enablement\Oxygen-training\Class-files\5-8-2020\Jesse\OxygenIntro.ditamap
Engine name: XSLT
Severity: fatal
Description: XPath syntax error at char 23 on line 345 in {relpath:toUrl($inputdir)}:
Start location: 345:7

System ID: C:\dita-tech-enablement\Oxygen-training\Class-files\5-8-2020\Jesse\OxygenIntro.ditamap
Scenario: OxygenIntro (json)
Input file: C:\dita-tech-enablement\Oxygen-training\Class-files\5-8-2020\Jesse\OxygenIntro.ditamap
Engine name: DITA-OT
Severity: fatal
Description: Transformation failed. C:\Program Files\Oxygen XML Editor 20\frameworks\dita\DITA-OT2.x\plugins\org.dita4publishers.json\build_transtype-json.xml:24: javax.xml.transform.TransformerConfigurationException: Failed to compile stylesheet. 4 errors detected.


I haven't modified any of these .xsl files.

Also, my expectation is that this would generate a single json file with all the topics. My team could just as easily use an .xml file with all the resolved topics in raw XML. Is there a better way to do this?

Thanks in advance!

Re: Json transformation fails due to default xsl files

Posted: Thu Nov 19, 2020 8:55 am
by Radu
Hi,

I'm not sure what the problem is, can you maybe send us (support@oxygenxml.com) a link to download the DITA OT plugin and test it on our side? Does your plugin come with Java libraries or is it pure XSLT?

About this remark:
Also, my expectation is that this would generate a single json file with all the topics. My team could just as easily use an .xml file with all the resolved topics in raw XML. Is there a better way to do this?
One option would be to set on the main DITA Map <map> root element the "chunk='to-content'" attribute.
Another option would be to use the "DITA-OT2.x/plugins/com.oxygenxml.merged" plugin which comes pre-installed and which outputs a single merged XML document. Maybe you can modify the plugin to also apply an XSLT stylesheet over the merged XML and produce the JSON.

Regards,
Radu

Re: Json transformation fails due to default xsl files

Posted: Thu Nov 19, 2020 4:20 pm
by Jesse
Hi Radu,

I'm using what I think is just a default transformation scenario in the toolkit. I went to Transformation Scenarios > New > DITA OT transformation > json. The thing is - I don't think I need a stylesheet because I just want the raw xml from the topics to be compiled in a single file.
One option would be to set on the main DITA Map <map> root element the "chunk='to-content'" attribute.
Another option would be to use the "DITA-OT2.x/plugins/com.oxygenxml.merged" plugin which comes pre-installed and which outputs a single merged XML document. Maybe you can modify the plugin to also apply an XSLT stylesheet over the merged XML and produce the JSON.
I'd love to learn more about this. I actually already have the chunk='to-content" attribute set on the map tag. How do I find the xml.merged transform? I don't see the option.

Thanks!
-Jesse

Re: Json transformation fails due to default xsl files

Posted: Thu Nov 19, 2020 9:03 pm
by Jesse
Radu,

I'm thinking I might need to install this plug-in (in 20.1):
https://github.com/oxygenxml/dita-merged

I'm not sure how to do that though.

Thanks,
Jesse

Re: Json transformation fails due to default xsl files

Posted: Fri Nov 20, 2020 12:29 am
by Jesse
Radu,

As followup, I was able to use the Merge DITA content to single file transform to make the xml and then the convert it to json in Oxygen (downloaded the plug-in for that). Very slick!

Thanks again for your help.

-Jesse

Re: Json transformation fails due to default xsl files

Posted: Fri Nov 20, 2020 8:58 am
by Radu
Hi Jesse,

Great, I should have given you more details about how to create a new merge transformation by using in the Transformation Scenario dialog "New->DITA-OT" and choosing Merge DITA content to single file so sorry about that.
Out of curiosity what are your plans with the JSON file afterwards? Do you need to obtain a very specific JSON structure and thus need to process the XML further before the conversion to JSON?

Regards,
Radu

Re: Json transformation fails due to default xsl files

Posted: Fri Nov 20, 2020 5:47 pm
by Jesse
Radu,

No worries. I might suggest, however, changing "Merge DITA content to single file" in the UI to something like, "Merge DITA content to single XML file" so that it's more clear that that's what you are doing. :D

The json file is going to be sitting in our company's main software build, and its contents will be called to populate little pop-up help snippets (basically tool tips), and those snippets may link out to our greater, Drupal-based (but DITA-sourced) help center. Each topic has a unique reference ID that is used to link the topic to its appropriate location in the UI.

I have passed the json file off to the development team for testing. It remains to be seen if they will need further formatting, but I will keep you posted.

Thanks again for your help!
-Jesse

Re: Json transformation fails due to default xsl files

Posted: Mon Nov 23, 2020 9:14 am
by Radu
Hi Jesse,

Thanks for the feedback, I'll add an internal issue to rename the DITA to merged XML transformation type description so that it more accurately states that an XML file is obtained.

Regards,
Radu

Re: Json transformation fails due to default xsl files

Posted: Fri Mar 05, 2021 10:17 am
by Radu
Hi,

As an update, in the Oxygen 23.1 version we just released the transformation type is named "Merge DITA content to single XML file".

Regards,
Radu