Xml XSL-FO:如何设置整个文档的初始页码?
我的xml是根目录,有许多不同的子元素,每个子元素的顺序都不同,每个子元素在页面序列中都有自己的标记。Xslt模板接受本文档的一个参数初始页。我不能在页面序列的初始页码属性中设置它,因为我不知道哪个元素将是第一个。在xsl fo或xslt级别中,是否存在将给定的数字作为第一页序列的页码的变通方法 xml示例1:Xml XSL-FO:如何设置整个文档的初始页码?,xml,xslt,xsl-fo,Xml,Xslt,Xsl Fo,我的xml是根目录,有许多不同的子元素,每个子元素的顺序都不同,每个子元素在页面序列中都有自己的标记。Xslt模板接受本文档的一个参数初始页。我不能在页面序列的初始页码属性中设置它,因为我不知道哪个元素将是第一个。在xsl fo或xslt级别中,是否存在将给定的数字作为第一页序列的页码的变通方法 xml示例1: <root> <item-abc/> <item-def/> <item-ghj/> </root> xml示例2:
<root>
<item-abc/>
<item-def/>
<item-ghj/>
</root>
xml示例2:
<root>
<item-ghj/>
<item-ghj/>
<item-abc/>
</root>
xslt:
因为我不知道哪个元素会是第一个
如果是真的,请更改以下代码
<x:apply-templates select="root/item-abc"/>
<x:apply-templates select="root/item-def"/>
<x:apply-templates select="root/item-ghj"/>
这将满足您的要求。请提供XML和XSLT的最小摘录。我们不知道您的XSLT模板是什么样子的,所以我们很难帮助您更改它。@TonyGraham完成
<x:apply-templates select="root/item-abc"/>
<x:apply-templates select="root/item-def"/>
<x:apply-templates select="root/item-ghj"/>
<x:apply-templates select="root/*"/>
<x:template match="root/item-abc">
<fo:page-sequence master-reference="m" format="00001">
<x:if test="position() eq 1">
<x:attribute name="initial-page-number" select="'1'"/>
</x:if>
....
</fo:page-sequence>
</x:template>