How to use "data" element of a DITA map in generated HTML5 presets output (AEM Guides)

63 views Asked by At

I'm quite new to AEM Guides/XML Documentation and I am currently trying to figure out how to get "data" elements from a DITA Map in the generated AEM Site.

To clarify, the DITA Map has the following structure:

<map>

   <title>XXX</title>
   <data>

      <image id="logo" href="GUID-123asd123.jpg" ></image>

      <xref format="txt" href="GUID-asd123qwe.txt" id="copyright">

   </data>

   <topicref ... ></topicref>

</map>

I want to use contents of "data" element in sidebar nav.

e.g.:

  • show the "image" (from data in the map) on the sidebar nav

  • show the copyright disclaimer in footer section of the page according to "xref" tag in Map

I did some customizations on the sidebar nav by using JavaScript and CSS (I created a custom DITA-OT Plugin), but I don't understand how to access "data" so that I can use them in that customization.

Thanks.

1

There are 1 answers

0
Mistico On BEST ANSWER

I was able to solve it by adding the following lines of code in nav.xsl file which checks the image with ID logo


          <xsl:for-each select="$input.map//*[contains(@class, ' topic/data ')]/*[contains(@class,' topic/image ')][ends-with(@id, 'logo')]">
            <li>
              <img class="topic-logo" src="{current()/@href}" alt="{current()/@id}"/>
            </li>
          </xsl:for-each>