Luzgan
Luzgan

Reputation: 106

Check parent from ditamap

I have the following problem. I need somehow to know, that I am processing topicref, that is inside of preface.

So I have following ditamap (its of course part of it).

<frontmatter>
    <preface href="preface.dita">
            <topicref href="somethingp1.dita"></topicref>
            <topicref href="somethingp2.dita"></topicref>
            <topicref href="somethingp3.dita"></topicref>
    </preface>
</frontmatter>
<chapter href="something.dita">
    <topicref href="something2.dita"/>
    <topicref href="something3.dita"/>
</chapter>

Now the question is, can I somehow check if I am processing topicref from preface and not from chapter.

To be more specific, I have to specify different attributes for p tag that is used in preface (because maybe there is better way to do it).

Is it possible?

Upvotes: 1

Views: 135

Answers (1)

barbwire
barbwire

Reputation: 218

Maybe this helps you:

<xsl:template match="//topicref">
    <xsl:if test="name(parent::*) = 'preface'">
        ... do something
    </xsl:if>
</xsl:template>

Upvotes: 2

Related Questions