Доброе утро, Я пытаюсь написать XSLT 1.0 trasformation превратить этотДобавление атрибута к каждому дочернему узлу с помощью XSLT
<foo>
<document>
<content name="bar1">Bar1</content>
<content name="bar2">Bar2</content>
<content name="bar3">Bar3</content>
...
</document>
</foo>
к этому
<foo>
<document>
<content name="bar1" set="top">Bar1</content>
<content name="bar2" set="top">Bar2</content>
<content name="bar3" set="top">Bar3</content>
...
</document>
</foo>
поэтому я попытался это XSLT преобразование
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*" />
</xsl:copy>
</xsl:template>
<foo>
<document>
<xsl:template match="/document/*">
<xsl:copy>
<xsl:apply-templates />
<xsl:attribute name="set" select="'top'" />
</xsl:copy>
</xsl:template>
</document>
</foo>
, но, к сожалению, он не работал
Я пробовал много искать в руководствах xpath и xslt, но я не могу получить эту работу, может кто-нибудь мне помочь?