Page 1 of 1

Test for contents of a Map

Posted: Thu Apr 25, 2024 12:50 am
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.

Re: Test for contents of a Map

Posted: Thu Apr 25, 2024 9:36 am
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
You can also check the Inheritance section of the DITA Specification (e.g. <keyword> element)

Regards,
Julien

Re: Test for contents of a Map

Posted: Thu Apr 25, 2024 5:35 pm
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