Map transformation that runs XSLT transformation on the topi

Post here questions and problems related to editing and publishing DITA content.
Frank Ralf
Posts: 482
Joined: Thu Jan 23, 2014 2:29 pm
Location: Hamburg
Contact:

Map transformation that runs XSLT transformation on the topi

Post by Frank Ralf »

Hi,

I want to create a map transformation which runs a normal XSLT transformation on every topic. The use case is a software block (map) with each function described in a separate topic. The XSLT transformation shall generate a header file from all the topics referenced in the map. The output shall be one header file containing all functions for the software block.

Any pointers welcome

TIA
Frank
Frank Ralf
parson AG
www.parson-europe.com
Radu
Posts: 9446
Joined: Fri Jul 09, 2004 5:18 pm

Re: Map transformation that runs XSLT transformation on the

Post by Radu »

Hi Frank,

You may want to take a look at the XSL George wrote which gets applied on a DITA Map and generates a report for content loaded from all referenced topics:

OXYGEN_INSTALL_DIR\frameworks\dita\report\report.xsl

When applied on the root map element the template gets all the content of the DITA Map expanded in a single variable:

Code: Select all

        <xsl:variable name="resolved">
<oxyd:mapref xml:base="{document-uri(.)}">
<xsl:apply-templates select="/" mode="resolve"/>
</oxyd:mapref>
</xsl:variable>
That merged content is obtained by calling templates from the XSLT module:

OXYGEN_INSTALL_DIR\frameworks\dita\report\modules\resolve.xsl

which you could probably re-use completely in your XSLT stylesheet.

After you have the content with all topicrefs expanded in a single variable, you can do anything you want with it.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Frank Ralf
Posts: 482
Joined: Thu Jan 23, 2014 2:29 pm
Location: Hamburg
Contact:

Re: Map transformation that runs XSLT transformation on the

Post by Frank Ralf »

Hi Radu,

Many thanks, that looks great! I will give it a try and report back.

Kind regards,
Frank
Frank Ralf
parson AG
www.parson-europe.com
Frank Ralf
Posts: 482
Joined: Thu Jan 23, 2014 2:29 pm
Location: Hamburg
Contact:

Re: Map transformation that runs XSLT transformation on the

Post by Frank Ralf »

Hi Radu,

I got this working in principle, using the code-snippet from report.xsl. Some hints for others who want to give it a try:
  • 1. For instructions on multiple transformations (pipelining) in one stylesheet see http://www.oxygenxml.com/archives/xsl-l ... 00406.html.
    2. Because resolve.xsl uses some XSLT 2.0 features you have to make sure to choose a XSLT 2 capable engine in your transformation scenario.
Thanks again
Frank
Frank Ralf
parson AG
www.parson-europe.com
Post Reply