merlinsson
merlinsson

Reputation: 63

XSL identify inner tags

i have an XML file which looks like this:

<description>Some description<tt>some more description</tt> even more description</description>

In my XSL file I get the data from the description tag by this:

<xsl:value-of select="Description"/>

The result is the FO document is

Some description<tt>some more description</tt> even more description

How can I make my XSL-Stylesheet interpret the text between the

<tt>

tags as "italic" or some other text styles like "bold" or so?

Upvotes: 1

Views: 135

Answers (2)

sunbabaphu
sunbabaphu

Reputation: 1493

given your XML as:

<description>Some description<tt>some more description</tt> even more description</description>

this:

<xsl:template match="description/tt"> <span style="font-style: italic"> <xsl:value-of select="string(.)"/></span> </xsl:template>

will produce output as:

Some descriptionsome more descriptioneven more description

Upvotes: 2

michael.hor257k
michael.hor257k

Reputation: 117073

How can I make my XSL-Stylesheet interpret the text between the

<tt>

tags as "italic" or some other text styles like "bold" or so?

You could do this by writing a template that matches tt, for example:

<xsl:template match="tt">
    <italic>
        <xsl:apply-templates/>
    </italic>
</xsl:template>

--

Note:

<xsl:value-of select="Description"/>

does NOT return:

Some description<tt>some more description</tt> even more description

Upvotes: 1

Related Questions