更新时间:2023-02-22 11:37:36
我只想在
firstdto
中导入seconddto
函数.因为我想在第一个属性中使用seconddto
属性.
I just want to import
seconddto
function insidefirstdto
. Because i want to useseconddto
attributes inside first attributes.
如果你想在 firstdto
中使用 seconddto
的值,那么你可以试试这个:
If you want to use value from seconddto
inside firstdto
, then you can try this:
<xsl:template match="/sites">
<html>
<head>
<style>.....</style>
</head>
<body>
<xsl:apply-templates select="firstdto"/>
</body>
</html>
</xsl:template>
<xsl:template match="firstdto">
<xsl:copy-of select="link"/>
<xsl:copy-of select="../seconddto/link"/><!-- to use/copy value from other -->
<xsl:copy-of select="name"/>
</xsl:template>
得到如下输出:
<html>
<head>
<style>.....</style>
</head>
<body>
<link>google.com</link>
<link>yahoo.com</link>
<name>google</name>
</body>
</html>