Test for contents of a Map

Post here questions and problems related to editing and publishing DITA content.
Tinmen
Posts: 21
Joined: Wed Jun 28, 2023 11:49 pm

Test for contents of a Map

Post by Tinmen »

I have a map inside my bookmap that contains keywords assigned to SKUs.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map>
    <keydef keys="sku1">
        <topicmeta>
            <keywords>
                <keyword>ABC-1234567890123456</keyword>
            </keywords>
        </topicmeta>
    </keydef>
    <keydef keys="sku2">
        <topicmeta>
            <keywords>
                <keyword>DEF-1234567890123456</keyword>
            </keywords>
        </topicmeta>
    </keydef>
    <keydef keys="sku3">
        <topicmeta>
            <keywords>
                <keyword>GHI-1234567890123456</keyword>
            </keywords>
        </topicmeta>
    </keydef>
</map>
In my frontmatter.xsl file, I am attempting to test if the class exists so I can obtain the value to print on my cover page. However, I cannot figure out the right test criteria. I thought that

Code: Select all

topic/keyword
should work as I am assuming the skus.ditamap is a topic. I have tried other combinations such as

Code: Select all

topicmeta map keydef
, etc.

Code: Select all

<xsl:if test="//*[contains(@class, ' topic/keyword ')][1]">
Perhaps this assumption is wrong. If so, I would appreciate any help in sorting this out.
julien_lacour
Posts: 514
Joined: Wed Oct 16, 2019 3:47 pm

Re: Test for contents of a Map

Post by julien_lacour »

Hello,

You can check the class of any DITA elements by selecting it in Oxygen and checking the Attributes view:
image.png
image.png (12.77 KiB) Viewed 161 times
You can also check the Inheritance section of the DITA Specification (e.g. <keyword> element)

Regards,
Julien
Tinmen
Posts: 21
Joined: Wed Jun 28, 2023 11:49 pm

Re: Test for contents of a Map

Post by Tinmen »

Thanks Julien!
I did check the attributes view originally, and that's where I saw the topic/keyword as the class, which is what I tried to use. I will go back and check again.
Regards
Tinmen
Post Reply