Is it possible to combine this into a
single XSL?
It's posible to express this in a single transformation with multiple stylesheets modules.
If you don't know how DITA XSLT works, the best way would be: to use import
declaration for XSLT DITA, and to declare your own rules.
Edit: Example. Suppose this stylesheet base.xsl
:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="root">
<html>
<xsl:apply-templates/>
</html>
</xsl:template>
<xsl:template match="parent">
<p>
<xsl:apply-templates/>
</p>
</xsl:template>
<xsl:template match="child">
<b>
<xsl:apply-templates/>
</b>
</xsl:template>
</xsl:stylesheet>
With this input:
<root>
<parent>
<child>1</child>
</parent>
<parent>
<child>2</child>
</parent>
<parent>
<child>3</child>
</parent>
<parent>
<child>4</child>
</parent>
</root>
Output:
<html>
<p>
<b>1</b>
</p>
<p>
<b>2</b>
</p>
<p>
<b>3</b>
</p>
<p>
<b>4</b>
</p>
</html>
Now, this stylesheet ussing import
.
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="base.xsl"/>
<xsl:template match="parent">
<div>
<xsl:apply-templates/>
</div>
</xsl:template>
</xsl:stylesheet>
Output:
<html>
<div>
<b>1</b>
</div>
<div>
<b>2</b>
</div>
<div>
<b>3</b>
</div>
<div>
<b>4</b>
</div>
</html>