2014-07-18 121 views
0

我想將自定義CSS文件包含到jDocBook插件生成的HTML中。 這裏是插件配置:自定義CSS與JBoss jDocBook maven插件

<plugin> 
    <groupId>org.jboss.maven.plugins</groupId> 
    <artifactId>maven-jdocbook-plugin</artifactId> 
    <version>2.3.7</version> 
    <extensions>true</extensions> 
    <configuration> 
     <sourceDocumentName>book.xml</sourceDocumentName> 
     <imageResource> 
      <directory>${basedir}/src/main/images</directory> 
     </imageResource> 
     <cssResource> 
      <directory>${basedir}/src/main/css</directory> 
     </cssResource> 
     <formats> 
      <format> 
       <formatName>pdf</formatName> 
       <stylesheetResource>classpath:/docbook/fo/docbook.xsl</stylesheetResource> 
      </format> 
      <format> 
       <formatName>html</formatName> 
       <stylesheetResource>classpath:/docbook/html/chunk.xsl</stylesheetResource> 
      </format> 
     </formats> 
    </configuration> 
</plugin> 

我有一個在我的src/main/css命名爲driver.css文件。 生成此文件後,出現在target/docbook/publish/en-US/html旁邊book.html,但它不包括在內。

我也試圖

<?xml-stylesheet href="driver.css" type="text/css"?> 

添加到book.xml,但似乎並沒有幫助。

我在這裏是否缺少配置參數?

回答

1

爲了使用自定義CSS設置HTML輸出的樣式,必須將html.stylesheet=<path to css file>傳遞給XSLT處理器。要做到這一點使用JDocBook插件,必須加上下面的下<configuration>

<configuration> 
    ... 
    <options> 
     <transformerParameters> 
      <html.stylesheet>driver.css</html.stylesheet> 
     </transformerParameters> 
    </options> 
    ... 
</configuration> 

恥辱它不是在plugin documentation

描述而僅僅是明確的,xml樣式表的東西是不相關的