0

これは、私が抱えている問題の一般的な構造を明らかにする単純化された XML です。

<chapter num="07">
    <title>
        <page num="703"/>
        ... text (mixed content) ...
    </title>

    <page num="704"/>
    <section level="sect1">
        <title>...text...</title>
        <para num="7.1.1">... a lot of text (mixed content)...</para>
    </section>
    <section level="sect1">
        <title>... text... </title>
        <para num="7.2.1">Some text...
            <footnoteref linkend="fn3" num="3"/>
            <footnote num="3" id="fn3"> ... mixed content ...</footnote> 
            ...more text...
        </para>

        <page num="705"/>
        <section level="sect2">
            <title>...</title>
            <para num="7.2.2">... text ...
                <footnoteref linkend="fn4" num="4"/>
                <footnote num="4" id="fn4">...</footnote> 
                ... more text ...
                <footnoteref linkend="fn5" num="5"/>
                <footnote num="5" id="fn5">...</footnote> 
                ... more text ...
            </para>
            <para num="7.2.5">...

                <page num="706"/>... 

                <footnoteref linkend="fn6" num="6"/>
                <footnote num="6" id="fn6"> ... </footnote>
            </para>
            <para num="7.2.6">... some text
                <footnoteref linkend="fn7" num="7"/>
                <footnote num="7" id="fn7"> ... </footnote>  
            </para>
        </section>
    </section>
</chapter>

最後の先行する最初の一致する前に、1つの処理命令<?pb label='ページ番号を配置する必要があります。1 回だけ表示され、ページ番号は最後に表示された要素の属性の値と同じである必要があります。'?> <footnote><page>num<page>

たとえば、上記のソースを処理すると、結果ドキュメントでの直前、脚注 4 と 5 のグループ化)、直前の1 つ(脚注6 7 のグループ化) が生成されると予想されます。要素を処理するためのテンプレートがあり、それらは各ページの最後に一緒に配置され、前に処理命令が続きます (要素はそのまま残ります)。<?pb label='704'?><footnote num="3"> <?pb label='705'?><footnote num="4"> <?pb label='706'?><footnote num="6"><footnote><footnoteref>

私の XSL はこちらです。大きすぎるので、ここには貼り付けられません。

脚注処理命令 (pb ラベル) に重複があります。footnote最後のタグに続く最初のタグの前にのみ pblabel が必要pageです。と合わせてみましpreceding::pageたが、うまくいきませんでした。同じ処理命令が複数回繰り返されています。たとえば、<?pb label='706'?>footnote 6の最初footnotepage 706.

4

1 に答える 1

1

時間のかかる分析を行わずに判断するのは困難ですが、これを変更してみてくださいxsl:if( match="footnote" mode="footnote"):

    <xsl:if test="preceding::node()[page[1]]">
        <xsl:variable name="op">&#60;</xsl:variable>
        <xsl:variable name="apos">'</xsl:variable>
        <xsl:variable name="cl">&#62;</xsl:variable>

        <xsl:value-of select="concat($op,'?pb label=',$apos,preceding::page[1]/@num,$apos,'?',$cl)"/>

    </xsl:if>

これに:

    <xsl:if test="(preceding::page|preceding::footnote)[last()][self::page]">
        <xsl:processing-instruction name="pb" select="concat('label=''',preceding::page[1]/@num,'''?')"/>
    </xsl:if>

出力メソッドが HTML (SGML 処理命令を含む) の場合に、XML 処理命令を出力しようとしているのはちょっと奇妙です。

于 2014-05-08T15:20:26.797 に答える