Running identity transform creates unnecessary classes
Posted: Tue Nov 24, 2020 10:32 pm
Running the XSLT identity transform on a DITA document adds a bunch of classes to all the elements.
For example, this file:
with this transform (the identity transform):
produces this output:
For example, notice that each entry now has a class "- topic/entry" that was not in the original. What's going on?
For example, this file:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic id="MyTable">
<title>Table Test</title>
<body>
<section>
<title>Section Title</title>
<p><b id="1010title">Section Header</b><table frame="all" rowsep="1" colsep="1"
rowheader="headers" id="1010table">
<tgroup cols="4" align="left">
<colspec colname="c1" colnum="1" colwidth="1*"/>
<colspec colname="c2" colnum="2" colwidth="1*"/>
<colspec colname="c4" colnum="3" colwidth="1*"/>
<colspec colname="c5" colnum="4" colwidth="1*"/>
<tbody>
<row>
<entry><b>ID</b></entry>
<entry><b>Name</b></entry>
<entry><b>Part</b></entry>
<entry><b>Has procedure?</b></entry>
</row>
<row>
<entry>101010010</entry>
<entry>Component1</entry>
<entry>1234</entry>
<entry>yes</entry>
</row>
<row>
<entry>101010110</entry>
<entry>Component2</entry>
<entry>4567</entry>
<entry>no</entry>
</row>
</tbody>
</tgroup>
</table></p>
</section>
</body>
</topic>
Code: Select all
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?><topic xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/" id="r1t_labor_codes" ditaarch:DITAArchVersion="1.3" domains="(topic abbrev-d) a(props deliveryTarget) (topic equation-d) (topic hazard-d) (topic hi-d) (topic indexing-d) (topic markup-d) (topic mathml-d) (topic pr-d) (topic relmgmt-d) (topic sw-d) (topic svg-d) (topic ui-d) (topic ut-d) (topic markup-d xml-d) " class="- topic/topic ">
<title class="- topic/title ">Table Test</title>
<body class="- topic/body ">
<section class="- topic/section ">
<title class="- topic/title ">Section TItle</title>
<p class="- topic/p "><b id="1010title" class="+ topic/ph hi-d/b ">Section Header</b><table frame="all" rowsep="1" colsep="1" rowheader="headers" id="1010table" class="- topic/table ">
<tgroup cols="4" align="left" class="- topic/tgroup ">
<colspec colname="c1" colnum="1" colwidth="1*" class="- topic/colspec "/>
<colspec colname="c2" colnum="2" colwidth="1*" class="- topic/colspec "/>
<colspec colname="c4" colnum="3" colwidth="1*" class="- topic/colspec "/>
<colspec colname="c5" colnum="4" colwidth="1*" class="- topic/colspec "/>
<tbody class="- topic/tbody ">
<row class="- topic/row ">
<entry class="- topic/entry "><b class="+ topic/ph hi-d/b ">ID</b></entry>
<entry class="- topic/entry "><b class="+ topic/ph hi-d/b ">Name</b></entry>
<entry class="- topic/entry "><b class="+ topic/ph hi-d/b ">Part</b></entry>
<entry class="- topic/entry "><b class="+ topic/ph hi-d/b ">Has procedure?</b></entry>
</row>
<row class="- topic/row ">
<entry class="- topic/entry ">101010010</entry>
<entry class="- topic/entry ">Component1</entry>
<entry class="- topic/entry ">1234</entry>
<entry class="- topic/entry ">yes</entry>
</row>
<row class="- topic/row ">
<entry class="- topic/entry ">101010110</entry>
<entry class="- topic/entry ">Component2</entry>
<entry class="- topic/entry ">4567</entry>
<entry class="- topic/entry ">no</entry>
</row>
</tbody>
</tgroup>
</table></p>
</section>
</body>
</topic>