Perhaps you aren't supplying a value for the two stylesheet parameters?
Michael Kay
http://www.saxonica.com/
-----Original Message-----
From: Ann Marie Rubin [mailto:Annmarie(_dot_)Rubin(_at_)Sun(_dot_)COM]
Sent: 05 November 2004 14:37
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] XSLT - update attribute with new value
Hello David,
Thanks very much for your help. At least I now know that
this is possible.
My stylesheet outputs the xml file unchanged. It does not replace the
value with the value of $value. I am probably doing something wrong
with the variable declaration but don't see the problem. The
stylesheet
looks like this:
Do you see what might be wrong?
Thanks very much,
Ann Marie
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes" method="xml"/>
<xsl:variable name="attr" select="deployment-version"/>
<xsl:variable name="value" select='TEST'/>
<xsl:param name="attr"/>
<xsl:param name="value"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@*" priority="10">
<xsl:attribute name="{name()}">
<xsl:choose>
<xsl:when test="name()=$attr"><xsl:value-of
select="$value"/></xsl:when>
<xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
--+------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--