好的,继续我的问题。
假设我的页面现在是这样的:
一个.xml:
<page>
<header>Page A</header>
<content-a>Random content for page A</content-a>
<content-b>More of page A's content</content-b>
<content-c>More of page A's content</content-c>
<!-- This doesn't keep going: there are a predefined number of sections -->
</page>
B.xml:
<page include="A.xml">
<header>Page B</header>
<content-a>Random content for page B</content-a>
<content-b>More of page B's content</content-b>
<content-c>More of page B's content</content-c>
</page>
C.xml:
<page include="B.xml">
<header>Page C</header>
<content-a>Random content for page C</content-a>
<content-b>More of page C's content</content-b>
<content-c>More of page C's content</content-c>
</page>
转换后(on C.xml
),我想这样结束:
<h1>Page C</h1>
<div>
<p>Random content for page C</p>
<p>Random content for page B</p>
<p>Random content for page A</p>
</div>
<div>
<p>More of page C's content</p>
<p>More of page B's content</p>
<p>More of page A's content</p>
</div>
<div>
<p>Yet more of page C's content</p>
<p>Yet more of page B's content</p>
<p>Yet more of page A's content</p>
</div>
我知道我可以document(@include)
用来包含另一个文档。但是,递归有点超出我的范围。
我将如何编写这样的转换?