XML formatting not passing through thanks to XSLT issue

102 views Asked by At

I need to edit a transform we've got that changes DITA XML to a slightly different version of XML for our learning management system. Here's my problem: when I run the transform, I'm losing formatting in certain file type titles, even though it works in other file types titles. For example, when I create a summary file, u passes through in the just fine, but in a concept file, the u drops out. I've tried just about everything I can think of, but no dice. The problem seems to be that for concepts, I can pull in a navtitle from my map, but I can't with the other types (and this is a requirement for all file types, so once this is fixed, I'll need to apply it to everything).

I have this code listed in a "common" section that works with the summary, etc, types:

<xsl:template match="*[contains(@class,' topic/title ')]" mode="new_tt_common">
   <xsl:param name="prefix" select="''"/>
 <title>
    <xsl:value-of select="$prefix"/>
    <xsl:apply-templates mode="identity" xml:space="default"/>
 </title>
</xsl:template>

This accurately passes through any elements contained in title.

This code is for concepts:

<xsl:choose>
    <xsl:when test="$navtitle = ''">
        <xsl:apply-templates select="*[contains(@class,' topic/title ')]" mode="new_tt_common"/>
    </xsl:when>
    <xsl:otherwise>
        <title>
            <xsl:value-of select="$navtitle"/>
        </title>
            </xsl:otherwise>
</xsl:choose>

I have $navtitle defined earlier in the code correctly, I believe, as it is working fine. There's something about this chunk of code that is not correct and it's driving me nuts. Basically, if there is no navtitle, the title should become the title in the new file. If there is a navtitle, that should become the title in the new file.

Here are some samples of my input. This is my chapter map:

<topicref href="../topics/re_intro_1.dita" locktitle="yes" navtitle="Case Study: Reselling a Condo"/>
<topicref href="../topics/re_los_1.dita"/> 

The title in re_intro_1.dita:

<title><tm tmtype="reg">Introduction</tm> Testing</title>

The title in re_los_1.dita:

<title>Learning <i>Objective</i></title>

In this instance, I want the title of the first file to be "Case Study: Reselling a Condo and the second file to be Learning Objective. Currently, the title text is coming through fine, but I'm losing the italics on Objective.

Anybody have any ideas why the elements contained in title aren't coming through?

1

There are 1 answers

2
JulioV On

I suggest changing your otherwise to be an apply-templates rather than a value-of. That should pass the italics for further processing.