Expand my Community achievements bar.

SOLVED

Extracting a Map Otherprops Attribute or Data-About/Data Element

Avatar

Level 5

How can I use the contents of the otherprops attribute (applied to a map) or the contents of the <data-about><data>123456</data></data-about> element (also within the map) in the PDF output?

Example:

<map otherprops="123456" id="GUID-67df857b-c67f-4706-ac81-08c33093cf94-en_us">
<title>Map for Testing Short Outputs</title>
<data-about><data>123456</data></data-about>

 

I can see how easy it is to insert the BookNumber element of a Book Map into the PDF footer ( <div style="width:33.33%; float: right; text-align: right; font-size:0.8em">p/n: <span data-field="metadata" data-format="default" data-subtype="//bookid/booknumber">Book Number</span></div>), but unfortunately, all our DITA maps are maps, not bookmaps.

1 Accepted Solution

Avatar

Correct answer by
Level 6

for maps - if elements are placed inside topicmeta, it should work. 


Example:

<map otherprops="123456" id="GUID-bed2563b-0147-47ef-817b-565f3564bd94-en">
<title>Map for Testing Short Outputs</title>
<topicmeta>
<data-about>
<data>123456</data>
</data-about>
</topicmeta>
<topicref href="GUID-dcbc6292-bf82-47cc-8814-9838d6f7d74f-en.dita" type="topic">
</topicref>
</map>

PDF layout: <span data-field="metadata" data-format="default" data-subtype="//data-about[1]/data">//DATA-ABOUT[1]/DATA</span></p>

Output: 

AswiniLakshminarayanan_0-1684440967609.png

 

View solution in original post

3 Replies

Avatar

Correct answer by
Level 6

for maps - if elements are placed inside topicmeta, it should work. 


Example:

<map otherprops="123456" id="GUID-bed2563b-0147-47ef-817b-565f3564bd94-en">
<title>Map for Testing Short Outputs</title>
<topicmeta>
<data-about>
<data>123456</data>
</data-about>
</topicmeta>
<topicref href="GUID-dcbc6292-bf82-47cc-8814-9838d6f7d74f-en.dita" type="topic">
</topicref>
</map>

PDF layout: <span data-field="metadata" data-format="default" data-subtype="//data-about[1]/data">//DATA-ABOUT[1]/DATA</span></p>

Output: 

AswiniLakshminarayanan_0-1684440967609.png

 

Thank you! This solution worked.

What is the purpose of the [1]? I had tried using //data-about/data (because the bookmap information used //bookid/booknumber, but obviously that didn't work. So what does the [1] add to the field information?

Xpath expression where [1] locates the first occurrence of the <data-about> element.