Add metadata from DITA map to menu items in HTML output
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 12
- Joined: Wed Jun 05, 2019 10:39 am
- Location: Germany
Add metadata from DITA map to menu items in HTML output
Hi,
I have an XSLT-related question regarding the Oxygen WebHelp Responsive transformation.
I would like to get metadata from a DITA map and integrate it to the side toc navigation's elements (as an attribute).
The HTML part of this has to be done in sidetoc.xsl, I guess. But how can I get the data from the <audience> element in <topicmeta>? Unfortunately, I am not that familiar to XSLT/XPath so that I don't know how to access the DITA map from sidetoc.xsl or tocDitaImpl.xsl. I tried to use the integration of the <shortdesc> element as an example but had no success yet.
Would it also be possible to access the <audience> element in the DITA map from topic.xsl?
Thanks a lot in advance!
Best regards,
Anton
I have an XSLT-related question regarding the Oxygen WebHelp Responsive transformation.
I would like to get metadata from a DITA map and integrate it to the side toc navigation's elements (as an attribute).
The HTML part of this has to be done in sidetoc.xsl, I guess. But how can I get the data from the <audience> element in <topicmeta>? Unfortunately, I am not that familiar to XSLT/XPath so that I don't know how to access the DITA map from sidetoc.xsl or tocDitaImpl.xsl. I tried to use the integration of the <shortdesc> element as an example but had no success yet.
Would it also be possible to access the <audience> element in the DITA map from topic.xsl?
Thanks a lot in advance!
Best regards,
Anton
-
- Posts: 12
- Joined: Wed Jun 05, 2019 10:39 am
- Location: Germany
Re: Add metadata from DITA map to menu items in HTML output
Hi,
I managed to get the desired metadata. It was a bit tricky to understand the XPath syntax using variables.
This is my approach: (within the xsl template matching xsl:topic).
Unfortunately, there is a problem when I try to get only the metadata from topics at a deeper level. Here is an example:
With the XPath command it is possible to get the desired result, namely "expert".
When I try to achieve the same within sidetoc.xsl with
I get the @type values from parents and siblings, too. What am I doing wrong?
Best regards,
Anton
I managed to get the desired metadata. It was a bit tricky to understand the XPath syntax using variables.
This is my approach:
Code: Select all
<xsl:value-of select="toc:topicmeta/toc:audience/@type"/>
Unfortunately, there is a problem when I try to get only the metadata from topics at a deeper level. Here is an example:
Code: Select all
<map>
<title></title>
<topicref>
<topicmeta><audience type="novice"/></topicmeta>
<topicref>
<topicmeta><audience type="expert"/></topicmeta>
</topicref>
</topicref>
</map>
Code: Select all
map/topicref/topicref/topicmeta/audience/@type
When I try to achieve the same within sidetoc.xsl with
Code: Select all
//toc:toc/toc:topic/toc:topic/toc:topicmeta/toc:audience/@type
Best regards,
Anton
-
- Site Admin
- Posts: 275
- Joined: Thu Dec 24, 2009 11:21 am
Re: Add metadata from DITA map to menu items in HTML output
Hello,tonra wrote: ↑Fri Aug 16, 2019 3:10 pm
With the XPath commandit is possible to get the desired result, namely "expert".Code: Select all
map/topicref/topicref/topicmeta/audience/@type
When I try to achieve the same within sidetoc.xsl withI get the @type values from parents and siblings, too. What am I doing wrong?Code: Select all
//toc:toc/toc:topic/toc:topic/toc:topicmeta/toc:audience/@type
According with this topic https://www.oxygenxml.com/dita/1.3/spec ... adata.html in the DITA 1.3 Specification the <audience> metatdata element cascades to child <topicref> elements. This is why you are obtaining the values from set on the parent elements.
One way to avoid this is to use the <data> metadata element instead of <audience>. For example:
Code: Select all
<data name="audience" value="expert"/>
- The DITAVAL file - use the passthrough action to let the DITA-OT processor know that the values of the @audience attribute should be transferred in the HTML output:
Code: Select all
<val> <prop action="passthrough" att="audience"/> </val>
- The DITA Map file:
Code: Select all
<map cascade="nomerge"> <title>Passthrough</title> <topicref href="topic_1.dita" audience="expert"> <topicref href="topic_1_1.dita" audience="novice"/> <topicref href="topic_1_2.dita" audience="novice"/> </topicref> <topicref href="topic_2.dita" audience="novice"/> </map>
The the @audience attribute from the <topicref> element will be transferred as a @data-audience attribute on the corresponding Menu or TOC entry.
This topic in our User Manual describes how use a DITAVAL file with Webhelp Responsive: https://www.oxygenxml.com/doc/versions/ ... ntent.html
Regards,
Alin
Alin Balasa
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “DITA (Editing and Publishing DITA Content)”
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