XSL template for part element transformation
Posted: Mon Oct 03, 2022 11:41 pm
Hello,
I currently have a document that uses a part element that includes a topicmeta, a chapter and a topicref. My customer used a custom attribute and declared it in a dtd. However, I'm looking a way to insert it in an xhtml output. But for that, I need to find the XSL template used for the transformation.
So far, my source looks like this:
I have been looking into the topicmergeImpl.xsl but got no success in transforming one of its templates:
Would you have any pointers about a relevant template that would access the part transformation?
Thanks for any tips
I currently have a document that uses a part element that includes a topicmeta, a chapter and a topicref. My customer used a custom attribute and declared it in a dtd. However, I'm looking a way to insert it in an xhtml output. But for that, I need to find the XSL template used for the transformation.
So far, my source looks like this:
Code: Select all
<bookmap xml:lang="en" id="GUID-87F37878-D357-439F-9794-EF55A04B5491"
xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/">
<booktitle>
<booklibrary>Rules for</booklibrary>
<mainbooktitle>Materials and Welding</mainbooktitle>
</booktitle>
<part divisionLabel="2" id="GUID-EF333DD9-43C5-436E-AF90-837C22029056">
<topicmeta>
<navtitle>Materials</navtitle>
</topicmeta>
<chapter id="GUID-D3E288B0-C90C-464A-8C03-17FA3B4BB31A">
<topicref
href="topic1.xml"
id="GUID-1202A1BF-32B3-440B-88D7-2756FFBEF1E3"/>
</chapter>
</part>
</bookmap>
Code: Select all
<xsl:template match="*[contains(@class,' map/topicref ')]" mode="build-tree">
<xsl:choose>
<xsl:when test="not(normalize-space(@first_topic_id) = '')">
<xsl:apply-templates select="key('topic',@first_topic_id)">
<xsl:with-param name="parentId" select="generate-id()"/>
</xsl:apply-templates>
<xsl:if test="@first_topic_id != @href">
<xsl:apply-templates select="key('topic',@href)">
<xsl:with-param name="parentId" select="generate-id()"/>
</xsl:apply-templates>
</xsl:if>
</xsl:when>
<xsl:when test="not(normalize-space(@href) = '')">
<xsl:apply-templates select="key('topic',@href)">
<xsl:with-param name="parentId" select="generate-id()"/>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="contains(@class, ' bookmap/part ') or
(normalize-space(@navtitle) != '' or *[contains(@class,' map/topicmeta ')]/*[contains(@class,' topic/navtitle ')])">
<xsl:variable name="isNotTopicRef" as="xs:boolean">
<xsl:call-template name="isNotTopicRef"/>
</xsl:variable>
<xsl:if test="not($isNotTopicRef)">
<topic id="{generate-id()}" class="+ topic/topic pdf2-d/placeholder ">
<title class="- topic/title ">
<xsl:choose>
<xsl:when test="*[contains(@class,' map/topicmeta ')]/*[contains(@class,' topic/navtitle ')]">
<xsl:copy-of select="*[contains(@class,' map/topicmeta ')]/*[contains(@class,' topic/navtitle ')]/node()"/>coucouCOUOCOUCOUCOUUCUCOCC
</xsl:when>
<xsl:when test="@navtitle">
<xsl:value-of select="@navtitle"/>
</xsl:when>
</xsl:choose>
</title>
<!--body class=" topic/body "/-->
<xsl:apply-templates mode="build-tree"/>
</topic>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates mode="build-tree"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Thanks for any tips