Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xml XSL-FO:如何设置整个文档的初始页码?_Xml_Xslt_Xsl Fo - Fatal编程技术网

Xml XSL-FO:如何设置整个文档的初始页码?

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:

我的xml是根目录,有许多不同的子元素,每个子元素的顺序都不同,每个子元素在页面序列中都有自己的标记。Xslt模板接受本文档的一个参数初始页。我不能在页面序列的初始页码属性中设置它,因为我不知道哪个元素将是第一个。在xsl fo或xslt级别中,是否存在将给定的数字作为第一页序列的页码的变通方法

xml示例1:

<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>