2011-12-19 6 views
1

私はdocbook5とoxygen xml editorを使用しています。私はXSLTprocとFOPを介してPDFに行くつもりです。 "edition"タグの値をフッタに表示しようとしていますが、正しく動作していません。Docbook 5 XSLT: "edition"要素のクエリと戻り値が失敗しました

<?xml version="1.0" encoding="utf-8"?> 
<!DOCTYPE book 
<book version="5.0" xmlns="http://docbook.org/ns/docbook" 
    xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" 
    xmlns:svg="http://www.w3.org/2000/svg" xmlns:m="http://www.w3.org/1998/Math/MathML" 
    xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook"> 
     <info> 
     <title>User Manual</title> 
     <edition>Ed. 123456</edition> 
     </info> 
</book> 

とのフッターテンプレート:DocBookの5ソースの考える

適切

<?xml version="1.0" encoding="UTF-8"?> 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0"> 

<xsl:template name="footer.content"> 
    <xsl:param name="pageclass" select="''"/> 
    <xsl:param name="sequence" select="''"/> 
    <xsl:param name="position" select="''"/> 
    <xsl:param name="gentext-key" select="''"/> 

    <fo:block> 
    <!-- sequence can be odd, even, first, blank --> 
    <!-- position can be left, center, right --> 
    <xsl:choose> 

     <xsl:when test="$sequence = 'odd' and $position = 'left'"> 
     <fo:retrieve-marker retrieve-class-name="section.head.marker" 
         retrieve-position="first-including-carryover" 
         retrieve-boundary="page-sequence"/> 
     </xsl:when> 

     <xsl:when test="$sequence = 'odd' and $position = 'center'"> 
     <xsl:value-of select="ancestor-or-self::book/info/edition"/> 
     </xsl:when> 

    </xsl:choose> 
    </fo:block> 
</xsl:template> 
</xsl:stylesheet> 

値に戻り、私はツールバーのoxygenxmlのXQueryのセクションから照会ではなく、私はその文書をPDFに処理します。どんな助けでも最高!

答えて

1

DocBookの名前空間を考慮する必要があります。慣例により、名前空間URIはスタイルシートの接頭辞dにマップされます。あなたのカスタマイズファイルでこれを行います。

  1. はルート<xsl:stylesheet>要素に

    xmlns:d="http://docbook.org/ns/docbook" 
    exclude-result-prefixes="d" 
    

    を追加します。

    <xsl:value-of select="ancestor-or-self::d:book/d:info/d:edition"/>  
    

  • 変更

    <xsl:value-of select="ancestor-or-self::book/info/edition"/> 
    

  • 関連する問題