Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

newbie question: XSLT Change attributes value

843834Sep 11 2007 — edited Sep 12 2007
Hi 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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 10 2007
Added on Sep 11 2007
6 comments
285 views