DITA: Create table from release-managemt domain elements

Here should go questions about transforming XML with XSLT and FOP.
Posts: 32
Joined: Wed Jun 20, 2018 11:30 am

DITA: Create table from release-managemt domain elements

Post by pieterjan_vdw » Tue Jul 09, 2019 3:28 pm


I would like to have the following: a summary table with all changes I added in every topic in the release domain elements with a link to the file.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="test">
         <change-item product="productA productB">
            <change-person>Joan Smith</change-person>
            <change-summary>Made change 1 to both products</change-summary>
            <data>Details of change 1</data>
         <change-item product="productA">
            <change-person>Bill Carter</change-person>
            <change-summary>Made change 2 to product A</change-summary>
            <data>Details of change 2</data>
         <change-item product="productA productB">
            <change-person>Richard Smith</change-person>
            <change-summary>Made change 3 to both products</change-summary>
            <data>Details of change 3</data>
Starting point: ditamap with topicref (can be nested topicref) or bookmap.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
   <topicref href="test.dita" type="concept" navtitle="Test" format="dita" scope="local">
      <topicref href="summary.dita"/>

This is what I currently have:
  • Table
  • 4 columns with heading row
  • Column 1: values of change-person in each row
  • Column 2: values of change-completed in each row
  • Column 3: values of change-description in each row
This is what I would like to add in my fourth column: href to the file (same href as the one in ditamap I am starting from).

Current XSLT:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

<xsl:template name="change_history" match="node() | @*">
   <xsl:result-document doctype-public="-//OASIS//DTD DITA Topic//EN" doctype-system="topic.dtd" indent="yes">
<xsl:attribute name="id">history_list</xsl:attribute>
<xsl:element name="title">History update</xsl:element>
<xsl:element name="table">
   <xsl:element name="tgroup">
         <xsl:attribute name="cols">4</xsl:attribute>
         <colspec colname="c1" colnum="1" colwidth="1*"/>
         <colspec colname="c2" colnum="2" colwidth="1*"/>
         <colspec colname="c3" colnum="3" colwidth="1*"/>
         <colspec colname="c4" colnum="4" colwidth="1*"/>
            <xsl:element name="thead">
         <xsl:element name="tbody">
         <xsl:for-each select="//topicref">
         <xsl:variable name="changeitem" select="document(@href)//change-item" />
         <xsl:for-each select="$changeitem">
   <entry><xsl:value-of select="change-person"/></entry>
   <xsl:value-of select="change-summary"/>
      <xsl:value-of select="change-completed"/>
<!-- Here I need to add the href>
Thanks a lot in advance for the help.
If anyone knows an easier, also very welcome.

Posts: 7579
Joined: Fri Jul 09, 2004 5:18 pm

Re: DITA: Create table from release-managemt domain elements

Post by Radu » Fri Jul 12, 2019 1:39 pm

Hi Pieterjan,

It is not clear to me how your sample xsl:template is getting called.
You already seem to have in your xsl:template the @href attribute so this would imply you are applying the xsl:template on the topicref. And if you already have the @href why don't you use it?

Radu Coravu
<oXygen/> XML Editor

Post Reply