Search code examples
xmlpdfxsltdita

Need to make bold for attribute values in pdf (dita to pdf)


I want to show the different between attribute value and the corresponding element value. so i just need to make the bold for attribute value in dita to pdf using oxygen. I tried xsl for that but its not working:

My Input dita xml file is:

<data-about>
            <data type="data.module.code">HSXWB-A-79-11-11-00A01-000A-D</data>
            <data type="classification">01</data>
            <data type="responsible.partner.company">F0302</data>
            <data type="originator">F0302</data>
            <data type="applicability">ALL</data>
            <data type="data.module.reference.code">TRENTXWB-A-00-00-00-01A01-022A-D</data>
            <data type="quality.assurance">tabtop</data>
            <data type="skill.level">sk01</data>
            <data type="reason.for.update">First Release</data>
            <data type="publication.code">UNKNOWN PUBLICATION</data>
         </data-about>

My xsl(2.0) used as:

    <xsl:template match="/">
<fo:block xsl:use-attribute-sets="data">
        <xsl:apply-templates select="//data-about"/>
    </fo:block>
</xsl:template>

    <xsl:template match="data-about/*">
<fo:block xsl:use-attribute-sets="data">
        <xsl:value-of select="concat(@type, ' : ', current())"/>
</fo:block>
    </xsl:template>

Now i'm presently getting output as

data.module.code : HSXWB-A-79-11-11-00A01-000A-D

classification : 01

responsible.partner.company : F0302 .

.

.

I want the pdf output as

data.module.code : HSXWB-A-79-11-11-00A01-000A-D

classification : 01

responsible.partner.company : F0302

.

.

.

Please guide on this. Thanks in advance


Solution

  • To achieve a bold styling, you have to use <fo:inline>:

    <fo:inline font-weight="bold">
        <xsl:apply-templates select="node()"/>
    </fo:inline>
    

    For your example:

    <xsl:template match="data-about/*">
        <fo:block xsl:use-attribute-sets="data">
            <fo:inline font-weight="bold">
                <xsl:value-of select="@type"/>
            </fo:inline>
            <xsl:value-of select="concat(' : ', current())"/>
        </fo:block>
    </xsl:template>