newbie question: XSLT Change attributes value
843834Sep 11 2007 — edited Sep 12 2007Hi there,
I have something in my xml file as:
"
<prpoerty name="url" value="blablabla"
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
<property name="username" value="pw90dev2"/>
<property name="password" value="pw90dev2"/>
"
Now I want to reset the attribute value of "value" to be "12345", if the attribute value of "name" is "username".
So far, I have created souch xslt file, but I don't know how to set the attributes for this row. Here is my XSLT file,
"
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="user" select="12345"/>
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*" />
</xsl:copy>
</xsl:template>
<xsl:template match="property/@name[.='username']">
<xsl:if test="@name='username'">
( How can I have the attribute of "value" set to be "12345", and keep the attribute "name" untouched here )
</xsl:if>
</xsl:template>
</xsl:stylesheet>
My working environment is limited to XSLT 1.0 at this time.
Thanks a lot for the help.
Charlie.