2010-05-24 48 views
2

這是my previous question的相關問題。font-size/font-family沒有效果

我修改了前綴標題建議的代碼,以修改標題下面的p標籤。

<xsl:template match="topic[title='Preface']/body/section/p"> 
     <fo:block xsl:use-attribute-sets="preface.p"> 
      <xsl:apply-imports/> 
     </fo:block> 
    </xsl:template> 

<xsl:attribute-set name="preface.p"> 
     <xsl:attribute name="font-family">Helvetica</xsl:attribute> 
     <xsl:attribute name="color">red</xsl:attribute> 
     <xsl:attribute name="font-size">8pt</xsl:attribute> 
    </xsl:attribute-set> 

的顏色變化所需的文本 - 只有所需的文本,所以我知道這是抓住了正確的節點。但是,字體系列和大小不起作用。

有人知道我可以檢查的任何東西可能會覆蓋代碼嗎?

回答

1

HTML不具備的屬性font-familyfont-size,他們是CSS屬性,試試這個:

<xsl:attribute-set name="preface.p"> 
    <xsl:attribute name="style">font-family: Helvetica; color: red; font-size: 8pt;</xsl:attribute> 
</xsl:attribute-set> 
+0

模板匹配代碼駐留在我的dita2fo shell文件和屬性集合在dita2fo,PARMS文件。這一切都是XSL FO - 對嗎? 如果我要運行「name ='style'」屬性,建議我會收到:無效的屬性名'style'。忽略屬性。 – kman 2010-05-24 14:31:27

+0

啊,我不知道XSL FO,我假設你使用了代碼來生成HTML。 – svick 2010-05-24 14:33:51