[xsl] help needed with identity tranformation

Subject: [xsl] help needed with identity tranformation
From: ericmutoniwabo@xxxxxxxxxxx
Date: Mon, 28 Jan 2008 09:04:12 +0000

Can some one help me with identity transformation?

I have an XML file that I want to change few element values using
identity transformation and keeping the rest of the document unchanged.

here are samples of my xml and the xslt's

<?xml version="1.0" encoding="UTF-8"?>

<?xml version="1.0" encoding="UTF-8"?>
<!-- The Identity Transformation -->
<xsl:stylesheet version="1.0"
<xsl:template match="node()|@*">
<xsl:apply-templates select="@*|node()"/>

If I wanted to change for example the price of orange to $4 and
maintain the rest of the xml unchanged, how would I do that?

I want to change the "price" of "orange" to $4 for example. My logic is that I would
insert an element  "price" with value $4.
 I tried the xslt below without much success.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
<!-- Import the identity transformation. -->
<xsl:import href="identity.xslt"/>
<xsl:template match="fruit/orange/price">
<xsl:element name="{name()}"><xsl:value-of select="$4"/></xsl:element>

I am using saxon as processor.
when I apply "transform.xslt" against "fruit.xml", the value of 
"fruit/orange/price" is not changing.
 I can't seem to match the element that I want to change the
value of.
Anyone sees what I am doing wrong?

Thanks, Eric.

Current Thread