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

Simple attribute value replacement question

Subject: Simple attribute value replacement question
From: "Regina, Paul" <pregina@xxxxxxxxxx>
Date: Mon, 28 Jan 2002 18:39:41 -0500
regina paul
Here is an overly simplified example of what I am trying to do. I want
to convert from one XML to another, I am having trouble changing the
attribute "type". It needs to go from the word "dog" to the word

<?xml version="1.0"?>
	<pet type="dog">


<?xml version="1.0"?>
	<pet type="canine">

I thought this xsl would do it but apparently not:

<?xml version = "1.0" encoding = "UTF-8"?>
<xsl:transform xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
version = "1.0">

<xsl:template match = "petXML">
	<xsl:element name = "animalXML">
		<xsl:apply-templates select = "*"/>

<xsl:template match = "*">
	<xsl:apply-templates select="@type"/>
	<xsl:copy-of select = "."/>

<xsl:template match="@type[.='dog']">
		<xsl:value-of select="canine"/>


This is what I get:
<?xml version="1.0"?><animalXML><pet

Can someone please tell me where I am going wrong and how to do this?

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread


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.
First Name
Last Name
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.