我需要从属性中读取图像的路径。包含此属性的元素的路径仅由另一个元素的另一个属性引用。也就是说,我在一个元素中有一个 ID,该 ID 引用另一个 ID,该 ID 具有我想要的路径的属性所在的元素。我想将路径用作 html-tag 中的属性。
xml 源
<root>
<a lot of nodes>
<relation id="path_1" path="path/to/image1">
<relation id="path_2" path="path/to/image2">
...
<more nodes>
<reference path="path_1">
<reference path="path_2>
...
</root>
所需的输出(xslt 片段,类似这样的东西)
<xsl:template match="path/to/reference">
<img src="{@path}>
<xsl:apply-templates>
</xsl:template>
所需的输出(html片段)
<img src="path/to/image1>
...
<img src="path/to/image2>
如何使用元素“reference”中的 ID 从元素“relation”中读取 ID 的值?