Issue/Query:
Why does XML Add on v3.8 not support DITA 1.3 base element topic/div? For a migrated HTML document, the target topic .dita does not have any <div> tags.
AEM Instance:
AEM 6.5 + SP7 + SP8 + XML Add On v3.8
Issue Description:
Followed the steps from Migrate XHTML documents section of the document Installation and Configuration Guide
The .dita file that gets created after the import is stripped off of any and every <div> tags. Confirmed from the h2d.xsl that this is indeed the case.
<!-- divs: if we can base transform on a class, do so. -->
<!-- generic divs will fall through with no associated transform --><xsl:template match="div">
<xsl:template match="div">
<xsl:apply-templates select="*|text()|comment()"/>
</xsl:template>
Is there a planned/available hotfix to fix this issue?
@DivrajSingh
Views
Replies
Total Likes
Generally in context of HTML, "div" elements are for styling purposes whereas in DITA the styling is stripped off as presentation is separated out from content when working in DITA.
With that assumption the rule has a generic implementation.
However, in your implementation if you need to enable this, you can override that rule by:
So, the rule in h2d_extended.xsl will look like:
<xsl:template match="div" priority="2"> <div> <xsl:apply-templates select="*|text()|comment()"/> </div> </xsl:template>
I hope this answers your query.
Thanks for answering the previous query @DivrajSingh . Assigning priority to the div as suggested by you worked. I have a few follow up questions -
Views
Replies
Total Likes
Some background before I address both the queries in detail. The publishing mechanism from DITA to AEM Sites uses a configuration "/libs/fmdita/config/elementmapping.xml" which defines rules to map dita elements/attributes to the generate sites components/properties correspondingly.
You can read more about this in the section "Customize DITA element mapping with AEM components" of Installation and Configuration Guide (page 92)
Any changes required in the elementmapping.xml should be done in following way:
These steps are also defined in point 4 and 5 of section "Additional Notes" Installation and Configuration Guide (page 96)
Now for the first query, by default the class attributes are propagated but they are not visible in the rendered page. To enable that, you need to add following line to the specific rule in elementmapping.xml:
<outputClassFlag>true</outputClassFlag>
The snippet in elementmapping.xml will look like:
<ditaelement> <name>div</name> <class>- topic/div</class> <componentpath>fmdita/components/dita/wrapper</componentpath> <type>COMPOSITE</type> <target>para</target> <wrapelement>div</wrapelement> <outputClassFlag>true</outputClassFlag> </ditaelement>
NOTE: make sure you are doing the changes in the overridden file and testing after clearing the cache, as described in beginning of this post
For the second query, the attributes that are by default propagated from html to dita are "class" and "id" considering the fact that these attributes are supported in DITA as well. But if you have a case where the source HTMLs can have additional attributes which are also compliant with DITA specs then you can do following:
Step 1: add a rule in h2d_extended.xsl for getting additional/all attributes to DITA:
<xsl:template match="div" priority="2"> <div> <xsl:copy-of select="@*" /> <xsl:apply-templates select="*|text()|comment()"/> </div> </xsl:template>
Step 2: add rule in element mapping for propagating these attribute/values from DITA to AEM sites component properties
<ditaelement> <name>div</name> <class>- topic/div</class> <componentpath>fmdita/components/dita/wrapper</componentpath> <type>COMPOSITE</type> <target>para</target> <wrapelement>div</wrapelement> <outputClassFlag>true</outputClassFlag> <attributemap> <attribute from="dita-attribute-name" to="desired-property-in-aem-component" /> </attributemap> </ditaelement>
NOTE: make sure you are doing the changes in the overridden file and testing after clearing the cache, as described in beginning of this post
I hope this addresses both of your queries.
Views
Replies
Total Likes
Views
Like
Replies
Views
Likes
Replies