DITA: Create table from release-managemt domain elements
Posted: Tue Jul 09, 2019 3:28 pm
Hi,
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.
Starting point: ditamap with topicref (can be nested topicref) or bookmap.
This is what I currently have:
Current XSLT:
Thanks a lot in advance for the help.
If anyone knows an easier, also very welcome.
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">
<title>Test</title>
<prolog>
<!--...-->
<change-historylist>
<change-item product="productA productB">
<change-person>Joan Smith</change-person>
<change-completed>2013-03-23</change-completed>
<change-summary>Made change 1 to both products</change-summary>
<data>Details of change 1</data>
</change-item>
<change-item product="productA">
<change-person>Bill Carter</change-person>
<change-completed>2013-06-07</change-completed>
<change-summary>Made change 2 to product A</change-summary>
<data>Details of change 2</data>
</change-item>
<change-item product="productA productB">
<change-person>Richard Smith</change-person>
<change-completed>2013-07-20</change-completed>
<change-summary>Made change 3 to both products</change-summary>
<data>Details of change 3</data>
</change-item>
</change-historylist>
<!--...-->
</prolog>
<conbody>
</conbody>
</concept>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map>
<title>change_history</title>
<topicref href="test.dita" type="concept" navtitle="Test" format="dita" scope="local">
<topicref href="summary.dita"/>
</topicref>
</map>
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
Current XSLT:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<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">
<xsl:template name="change_history" match="node() | @*">
<xsl:result-document doctype-public="-//OASIS//DTD DITA Topic//EN" doctype-system="topic.dtd" indent="yes">
<topic>
<xsl:attribute name="id">history_list</xsl:attribute>
<xsl:element name="title">History update</xsl:element>
<body>
<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">
<row>
<entry>Person</entry>
<entry>Description</entry>
<entry>Date</entry>
<entry>File</entry>
</row>
</xsl:element>
<xsl:element name="tbody">
<xsl:for-each select="//topicref">
<xsl:variable name="changeitem" select="document(@href)//change-item" />
<xsl:for-each select="$changeitem">
<row>
<entry><xsl:value-of select="change-person"/></entry>
<entry>
<xsl:value-of select="change-summary"/>
</entry>
<entry>
<xsl:value-of select="change-completed"/>
</entry>
<entry>
<xref>
<!-- Here I need to add the href>
</xref>
</entry>
</row>
</xsl:for-each>
</xsl:for-each>
</xsl:element>
</xsl:element>
</xsl:element>
</body>
</topic>
</xsl:result-document>
</xsl:template>
</xsl:stylesheet>
If anyone knows an easier, also very welcome.