Hi Jens,
The XML document has a DOCTYPE declaration and when applying an XSLT stylesheet the XSLT processor (Saxon 9 in this case) being compliant with the XML standard needs to expand the DOCTYPE declaration and to supply all default attribute values (the DITA @class attribute values for example) to the processed XML document.
For example if I open in Oxygen this very small DITA topic:
Code: Select all
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic id="id">
<title>T</title>
<shortdesc>S</shortdesc>
<body>
<p>P</p>
</body>
</topic>
and I apply over it this XSLT stylesheet which contains a copy template (copies all the input to the output):
Code: Select all
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<!-- Copy all input nodes to the output -->
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
then I obtain this result:
Code: Select all
<topic xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/" id="id" 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 ">T</title>
<shortdesc class="- topic/shortdesc ">S</shortdesc>
<body class="- topic/body ">
<p class="- topic/p ">P</p>
</body>
</topic>
Those extra attributes which appeared all come as default attribute values from the DTD (from the DOCTYPE declaration referenced in the original topic).
But you can write your XSLT stylesheet to remove those unwanted attributes and namespace declarations, something like this:
Code: Select all
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs ditaarch"
xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/"
version="2.0">
<!-- Ommit attributes coming from the DTDs -->
<xsl:template match="@class | @domains | @ditaarch:DITAArchVersion"/>
<xsl:template match="node() | @*">
<xsl:copy copy-namespaces="no">
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
For example that extra
copy-namespaces="no" attribute on the xsl:copy will avoid copying the namespace declarations to the output file.
About the output you obtain:
That particular "topic/li" is the original @class attribute set on the <li>. Probably it appears because you make a mistake somewhere in the XSLT, match the @class attribute and output it as a text node. But without having your entire XSLT stylesheet it's hard to know.
About your original task of converting a DITA topic to a concept, Oxygen already has an XML refactoring action included for this. You can just right click inside the opened DITA topic and choose "Refactoring=>Convert to concept". And we also do this with XSLT, the top level XSLT which converts any DITA topic type to concept is this one:
OXYGEN_INSTALL_DIR\frameworks\dita\refactoring\dita-files-conversion-stylesheets\convert-resource-to-concept-entrypoint.xsl
Our XSLT stylesheet has some extensions which can only be used when it's bundled with an XML refactoring operation:
https://www.oxygenxml.com/doc/versions/ ... tools.html
Also Oxygen's XML refactoring operations avoid expanding the DOCTYPE declaration and thus adding default attributes when the XML document is processed via XSLT.
Regards,
Radu