[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XSLT - update attribute with new value

Subject: XSLT - update attribute with new value
From: Ann Marie Rubin <Annmarie.Rubin@xxxxxxx>
Date: Fri, 05 Nov 2004 09:36:39 -0500
xslt update variable
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>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.