XSLT级联结构应生成多个文件和目录(结果文档?



我得到了这样的结构:

<chapter 1>
    .. some infos of Chapter 1
    <Chapter 1.1>
        .. some infos of Chapter 1.1
        <Chapter 1.1.1>
         ... rekursiv going down here

       .. some infos of Chapter 1.1
    </Chapter 1.1>
    <Chapter 1.2>
        .. some infos of Chapter 1.2
        <Chapter 1.2.1>
         ... rekursiv going down here

       .. some infos of Chapter 1.2
    </Chapter 1.2>
    .. some infos of Chapter 1
</Chapter 1>

应生成以下文件:chapter_1.xmlchapter_1.1.xml第 1.1.1 章.xml第 1.2 章.xml第 1.2.1 章.xml

和 (!( 显示文件结构的内容文件。

a( 我想 xsl:result-document 可以生成所有章节文件,同时递归地访问结构。

b( 要生成 contentfile,它需要一个文档(某种文件处理程序(一直打开以并行写入内容或结构上的第二个循环只是FPR内容

你能给我你的意见/如何处理a(和b(

的最佳方式吗

这一切都自然而然地与这样的结构一起消失:

<xsl:template match="Chapter">
  <!-- add a link from the containing chapter to the contained chapter -->
  <link href="Chapter{@id}">Chapter {title}</link>
  <!-- process the contained chapter -->
  <xsl:result-document href="Chapter{@id}">
     <article>
        <xsl:apply-templates/>
     </article>
  </xsl:result-document>
</xsl:template>
换句话说,在

处理过程中的任何"时间"(尽管在描述函数程序时最好避免使用临时语言(,都有一堆打开的结果文档对应于输入中的章节元素堆栈,并且新元素被添加到此堆栈顶部的结果文档中。

Saxon-EE实际上会并行编写多个结果文档(在单独的线程中(,但这不是您需要注意的。

有关这方面的示例,请参阅 saxonica.com 上的 saxon-resources 下载中的 play.xsl 示例样式表 - 它不是递归的,它有固定的三个级别的游戏/行为/场景,但原理是相同的。

最新更新