Zaktualizuj tekst elementu za pomocą XSLT na podstawie param

Próbuję zrobić coś, co wydaje się być bardzo proste, ale nie mogę go uruchomić i nie mogę znaleźć żadnych przykładów, które nie dotyczą wielu nieistotnych rzeczy. Chcę zaktualizować zawartość tekstową określonego znacznika xml do określonej wartości (przekazany jako parametr, ten XSLT zostanie użyty z ant). Prosty przykład:

Chcę się przekształcić

<code><foo>
  <bar>
    baz
  </bar>
</foo>
</code>

Do

<code><foo>
    <bar>
        something different
    </bar>
</foo>
</code>

To jest arkusz stylów, który próbowałem, co skutkuje tylko tagami, bez żadnego tekstu

<code><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <!-- identity transformation, to keep everything unchanged except for the stuff we want to change -->
    <!-- Whenever you match any node or any attribute -->
    <xsl:template match="node()|@*">
        <!-- Copy the current node -->
        <xsl:copy>
            <!-- Including any attributes it has and any child nodes -->
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>

    <!-- change the text of the bar node, in the real template the value won't be specified inline -->
    <xsl:template match="/foo/bar/">
        <xsl:param name="baz" value="something different"/>
            <xsl:value-of select="$baz"/>
    </xsl:template>
</xsl:stylesheet>
</code>

Z góry dziękuję!

questionAnswers(3)

yourAnswerToTheQuestion