Using conkeyref with DITA glass transform
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 7
- Joined: Sun Feb 08, 2015 7:45 am
Using conkeyref with DITA glass transform
Hi,
I am trying to figure how I can do keydefs and conkeyrefs when I have several markdown files and several DITA files. Is there any example that I can look at to see how it could be possible?
Specifically, my situation is as follows:
1. Markdown files that need to pull in some markdown content (mostly references to images and some text) via conkeyref
2. DITA files that will conkeyref the above MD files
3. DITA maps that contain topicrefs to the DITA files and MD files above and will be used to build a PDF as well as SCORM output.
I greatly appreciate any help.
Thanks,
Jayaram
I am trying to figure how I can do keydefs and conkeyrefs when I have several markdown files and several DITA files. Is there any example that I can look at to see how it could be possible?
Specifically, my situation is as follows:
1. Markdown files that need to pull in some markdown content (mostly references to images and some text) via conkeyref
2. DITA files that will conkeyref the above MD files
3. DITA maps that contain topicrefs to the DITA files and MD files above and will be used to build a PDF as well as SCORM output.
I greatly appreciate any help.
Thanks,
Jayaram
-
- Posts: 9428
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Using conkeyref with DITA glass transform
Hi Jayaram,
I assume that you have downloaded and tested our DITA Glass GitHub project:
https://github.com/oxygenxml/dita-glass
Please see some possible answers below:
you are in control of the pipeline, you control the Javascript converter which gets applied on the original Markdown to convert it to HTML and the XSLT converter which converts the XHTML to DITA. So you can perform your own processing there.
Regards,
Radu
I assume that you have downloaded and tested our DITA Glass GitHub project:
https://github.com/oxygenxml/dita-glass
Please see some possible answers below:
I'm not sure there are markdown constructs to do this. But as you saw in the example in which the markdown file is referenced in the DITA Map:1. Markdown files that need to pull in some markdown content (mostly references to images and some text) via conkeyref
Code: Select all
<topicref href="convert:/processor=xslt;ss=urn:processors:h2d.xsl/processor=xhtml/processor=js;js=urn:processors:md:Markdown.Converter.js;fn=convertExternal!/urn:files:sample.md" format="dita"/>
Again, by modifying the XSLTs and the Javascript conversion stage you control the content of the DITA topic obtained from the MD file. So you can for example set IDs on various elements in the converted DITA topic in order to reuse them from other topics.2. DITA files that will conkeyref the above MD files
The DITA Glass project has a DITA map which references various formats and can be published to WebHelp or PDF using some predefined transformation scenarios. Not sure about SCORM output, I remember there was a DITA OT plugin for it but I have not used it.3. DITA maps that contain topicrefs to the DITA files and MD files above and will be used to build a PDF as well as SCORM output.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 7
- Joined: Sun Feb 08, 2015 7:45 am
Re: Using conkeyref with DITA glass transform
Hi Radu,
Thanks for your reply. I will give some example to hopefully work through this. My top level map has:
App-formulas.dita has:
The warning in Author is:
and imagekeys.ditamap has:
When I run the PDF transform, I get the message:
Thanks,
Jayaram
Thanks for your reply. I will give some example to hopefully work through this. My top level map has:
Code: Select all
<map>
<title>DITA Glass</title>
<topicref href="resources/images-md/imagekeys.ditamap" format="ditamap"></topicref>
<topicref href="contentkeys.ditamap" format="ditamap"></topicref>
<topicref href="App-formulas.dita" format="dita"/>
</map>
Code: Select all
<concept id="concept-1-zKuLfRBb" xml:lang="en"><title>App formulas</title>
<conbody>
<p conkeyref="cont-app-formula"/>
</conbody>
</concept>
My lower level contentkeys.ditamap has:[Document]:Conref was not expanded:
The source element "p" with class value "- topic/p " is not a generalization of target element "topic" with class value "- topic/topic "
Code: Select all
<map>
<title>AppSheet Content</title>
<keydef keys="cont-app-formula" href="convert:/processor=xslt;ss=urn:processors:h2d.xsl/processor=xhtml/processor=js;js=urn:processors:md:Markdown.Converter.js;fn=convertExternal!/urn:files:App-formulas.md" format="dita"/>
</map>
Code: Select all
<map>
<title>AppSheet Images</title>
<keydef keys="img-app-formula-btn" href="img-app-formula-btn.dita"/>
</map>
What I want to know is how to fix this?[DOTX015E]: The attribute conref="urn_files_App-formulas.md.dita" uses invalid syntax. The value should contain '#' followed by a topic or map ID, optionally followed by '/elemID' for a sub-topic element.
Thanks,
Jayaram
-
- Posts: 9428
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Using conkeyref with DITA glass transform
Hi Jayaram,
The syntax of a conkeyref needs to be something like:
You already have the key name set on the keydef but you also need to point to the ID of a paragraph which will be reused.
So you should try to change the XSLT stylesheet used to generate the topic from the markdown in order to generate IDs on all elements that you want to reuse.
The same thing about the conref, the syntax of the conref attribute should be something like:
where the topic ID is the ID of the topic root element and the elementID again needs to be present after the conversion.
Regards,
Radu
The syntax of a conkeyref needs to be something like:
Code: Select all
<p conkeyref="keyName/targetElementID"/>
So you should try to change the XSLT stylesheet used to generate the topic from the markdown in order to generate IDs on all elements that you want to reuse.
The same thing about the conref, the syntax of the conref attribute should be something like:
Code: Select all
conref="convert:/processor=xslt;ss=urn:processors:h2d.xsl/processor=xhtml/processor=js;js=urn:processors:md:Markdown.Converter.js;fn=convertExternal!/urn:files:App-formulas.md#topicID/elementID"
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 7
- Joined: Sun Feb 08, 2015 7:45 am
Re: Using conkeyref with DITA glass transform
Hi Radu,
Thanks for clarifying that - I don't know if I am making it more complicated than it needs to be.
Anyway, I was wondering about other possibilities:
1. What if I want to insert the entire contents (and not a specific element inside it) of the .md file into App-forumulas.dita file ? It would be easiest if I could say <topic conkeyref="cont-app-formula"/> inside App-forumulas.dita but I can't.
2. Maybe I can save the DITA file generated from the .md file, and do a two stage conversion with two ditamaps. After running the conversion using the first ditamap, I could run a script that updates the intermediate DITA file with elementIDs and modifies the conkeyrefs appropriately.
I am trying to find the best alternative.
Regards,
Jayaram
Thanks for clarifying that - I don't know if I am making it more complicated than it needs to be.
Anyway, I was wondering about other possibilities:
1. What if I want to insert the entire contents (and not a specific element inside it) of the .md file into App-forumulas.dita file ? It would be easiest if I could say <topic conkeyref="cont-app-formula"/> inside App-forumulas.dita but I can't.
2. Maybe I can save the DITA file generated from the .md file, and do a two stage conversion with two ditamaps. After running the conversion using the first ditamap, I could run a script that updates the intermediate DITA file with elementIDs and modifies the conkeyrefs appropriately.
I am trying to find the best alternative.
Regards,
Jayaram
-
- Posts: 9428
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Using conkeyref with DITA glass transform
Hi Jayaram,
Also an alternative to DITA Glass is this DITA Open Toolkit plugin which again can be used to convert markdown files referenced in the DITA Map to DITA Topics:
https://github.com/jelovirt/dita-ot-markdown
Regards,
Radu
Yes, this should work. What problem does it report if you try it?1. What if I want to insert the entire contents (and not a specific element inside it) of the .md file into App-forumulas.dita file ? It would be easiest if I could say <topic conkeyref="cont-app-formula"/> inside App-forumulas.dita but I can't.
Yes, you could also have some custom processing which from time to time converts markdown files to dita files and keeps them perfectly synchronized.2. Maybe I can save the DITA file generated from the .md file, and do a two stage conversion with two ditamaps. After running the conversion using the first ditamap, I could run a script that updates the intermediate DITA file with elementIDs and modifies the conkeyrefs appropriately.
Also an alternative to DITA Glass is this DITA Open Toolkit plugin which again can be used to convert markdown files referenced in the DITA Map to DITA Topics:
https://github.com/jelovirt/dita-ot-markdown
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 7
- Joined: Sun Feb 08, 2015 7:45 am
Re: Using conkeyref with DITA glass transform
Hi Radu,
I was able to get the entire topic to be transcluded using the topic with the <topic conkeyref="cont-app-formula"/> syntax. The error I saw before was because I did not do it with the project settings of dita-glass.
Also, thanks for the pointer about data-ot-markdown. I am able to install the plugin to the Oxygen tree and run it via command line but when I run a transform in Oxygen, I am getting the following error:
Thanks,
Jayaram
I was able to get the entire topic to be transcluded using the topic with the <topic conkeyref="cont-app-formula"/> syntax. The error I saw before was because I did not do it with the project settings of dita-glass.
Also, thanks for the pointer about data-ot-markdown. I am able to install the plugin to the Oxygen tree and run it via command line but when I run a transform in Oxygen, I am getting the following error:
I even ran the DITA OT Integrator transform but still seeing this. What am I doing wrong?[DOTJ013E] Failed to parse the referenced file 'file:/Users/user/Documents/DITA/dita-ot-markdown/src/test/resources/codeblock.md'.: com.elovirta.dita.markdown.MarkdownReader
Thanks,
Jayaram
-
- Posts: 9428
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Using conkeyref with DITA glass transform
Hi Jayaram,
I'm glad the first part works for you.
About trying the DITA OT Markdown plugin, you should edit the transformation scenario and in the "Advanced" tab there is a Libraries button. In the Libraries list you should add additional references to all libraries needed by the MarkDown plugin, which are in the folder:
OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT2.x\plugins\com.elovirta.dita.markdown
Regards,
Radu
I'm glad the first part works for you.
About trying the DITA OT Markdown plugin, you should edit the transformation scenario and in the "Advanced" tab there is a Libraries button. In the Libraries list you should add additional references to all libraries needed by the MarkDown plugin, which are in the folder:
OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT2.x\plugins\com.elovirta.dita.markdown
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “General XML Questions”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service