I am trying to do something similar, it should be very simple, but I cannot get it to work, and I cannot find examples that do not include many irrelevant things. I want to update the text content of a specific xml tag to a specific value (passed as a parameter, this XSLT will be used from ant). A simple example:
I want to convert
<foo> <bar> baz </bar> </foo>
To
<foo> <bar> something different </bar> </foo>
This is the stylesheet I tried, which only leads to tags, no text at all
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="/foo/bar/"> <xsl:param name="baz" value="something different"/> <xsl:value-of select="$baz"/> </xsl:template> </xsl:stylesheet>
Thanks in advance!
source share