0

我想创建一个结构来迭代,但它的内容应该是现有节点。像这样:

<xsl:variable name='my_structure'>
    <rows-to-add>
      <row>existing-node-with-a-specific-path</row>
      <row>existing-node-with-a-specific-path</row>
    </rows-to-add>
    <rows-to-add>
      <row>existing-node-with-a-specific-path</row>
      <row>existing-node-with-a-specific-path</row>
      <row>existing-node-with-a-specific-path</row>
    </rows-to-add>
</xsl:variable>

所以我可以遍历 $my_structre 并应用一些逻辑。

那可能吗?

4

1 回答 1

0

Use <xsl:copy-of select="existing-node-with-a-specific-path"/> to copy the nodes into your variable.

One thing that comes to mind is the use of relative URI addresses in your existing data. When I've done the above, I've added xml:base-uri="{base-uri(.)}" into the variable, because without it, then resolving a relative URI would be relative to your stylesheet and not your data.

于 2013-09-27T16:20:47.480 回答