Merging Multiple Nested Topic Files Together
Posted: Sun Sep 25, 2022 3:49 am
To restructure the topics in some portion of a map, we sometimes use the following approach:
then running a refactoring operation to replace the topic references with the topic content:
When I run this refactoring operation in Oxygen, document() includes xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/" in its return result:
But when I run this same stylesheet with Saxon from the command line:
then the namespace is not added.
My guess is that Oxygen enhances document() to infer namespaces for known XML document types to improve robustness of XML processing. But in my case, I would like to omit the namespace.
Is there some XSLT directive (perhaps Oxygen-specific) to omit this namespace inference in document()? I was not able to find one. If not, I can add some additional processing to strip the namespace, but I would like to avoid that if I can.
A testcase is included:
To run,
- Merge those topic files into a single temporary topic file with nested subtopics.
- Rewrite/restructure the content, modifying the subtopic structure as needed.
- Split the restructured topic back into separate topic files.
then running a refactoring operation to replace the topic references with the topic content:
Code: Select all
<xsl:template match="topicref[ends-with(@href, '.dita')]">
<xsl:variable name="topic-content" select="document(@href)" as="item()"/>
<xsl:sequence select="$topic-content/*"/>
<xsl:apply-templates select="*"/>
</xsl:template>
But when I run this same stylesheet with Saxon from the command line:
Code: Select all
java -jar $SAXON_JAR -xsl:refactoring/resolve-topicrefs.xsl -s:OPENME3.dita
My guess is that Oxygen enhances document() to infer namespaces for known XML document types to improve robustness of XML processing. But in my case, I would like to omit the namespace.
Is there some XSLT directive (perhaps Oxygen-specific) to omit this namespace inference in document()? I was not able to find one. If not, I can add some additional processing to strip the namespace, but I would like to avoid that if I can.
A testcase is included:
To run,
- Open the OPENME1.xpr file.
- Open the OPENME2.ditamap file in the DITA Maps Manager.
- Open the OPENME3.dita topic file.
- Copy some topic references from the DITA Maps Manager, then Paste as XML into OPENME3.dita and save.
- Run the "Replace <topicref> with <topic> content" refactoring operation on OPENME3.dita.