Allow variables to be referenced from @scope="peer" maps
This is an FYI for an enhancement request I filed for the DITA-OT, in case anyone else would find it useful too:
Allow variables to be referenced from @scope="peer" maps #3685
The text is as follows:
DescriptionI have two books, bookA and bookB. bookA references bookB as a @scope="peer" map:
<title>Book A Map</title>
<mapref href="bookB.ditamap" scope="peer" keyscope="bookB" processing-role="resource-only"/>
<!-- ^^^^^^^^^^^^^ ^^^^ ^^^^^
In a topic in bookA, I would like to reference a "Product" variable from bookB:
<p>BookB provides more information on <ph keyref="bookB.Product"/>.</p>
<!-- ^^^^^^^^^^^^^ -->
Unfortunately, @scope="peer" suppresses all bookB content from the bookA transformation - topic content and variable definitions.
This enhancement requests that keyscoped @scope="peer" maps pull their keys (but not topics) from the referenced map into the current map.
To test this, unarchive the following testcase:
#### ditaot_keys_from_peer_books.zip ####
dita -i bookA.ditamap -i bookA.ditamap -f html5 -o out
Possible SolutionI tried implementing a proof-of-concept solution, which you can see in the testcase directory as follows:
diff maprefImpl.xsl.ORIG maprefImpl.xsl.NEW
The attempt was to remember when we're in a @scope="peer-with-keys" context, that would keep all mapref contents except topic references. Unfortunately, even this naive attempt did not work - the variables still did not resolve, and bookB topics still showed up in the bookA output directory. (You will need to change @scope="peer" to @scope="peer-with-keys" to try this proof-of-concept on the provided testcase.)
Potential AlternativesI am aware of warehouse topics, shared key definition files, etc. However, those are not a good fit for this need. This enhancement is for the case where we're already referencing a peer book and that book already defines the variables we want (for its own use), and we simply want to access them as well.