2015-11-10 24 views
1

我遇到以下問題。我需要以某種方式知道,我正在處理topicref,這是序言中的內容。從ditamap檢查父項

所以我有以下ditamap(當然是它的一部分)。

<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> 

現在的問題是,我可以以某種方式檢查是否從前言處理topicref而不是從章節處理topicref。

更具體地說,我必須爲序言中使用的p標籤指定不同的屬性(因爲也許有更好的方法可以做到這一點)。

可能嗎?

+0

哪種輸出格式,你的工作嗎? PDF?你在使用DITA Open Toolkit或其他工具嗎? –

+0

PDF和我正在使用DITA OT - 是的。其實我已經解決了它,通過使用$ map變量。對不起,真的遲到的答覆,並感謝您的參與。 – Luzgan

回答

2

也許這可以幫助你:

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