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

Re: How to replace the value for an attribute

Subject: Re: How to replace the value for an attribute
From: Gary Frederick <gary.frederick@xxxxxxxxx>
Date: Tue, 29 May 2001 07:16:58 -0500
xsl attribute replace value
Woo hoo, one I can answer.

You can use <xsl:element> to build the tag.

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

<xsl:template match="Message">
<xsl:element name="input">
<xsl:attribute name="type">hidden</xsl:attribute>
<xsl:attribute name="name">id</xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="@id" /></xsl:attribute>


A test:

[ggf@eeyore test]$ ./runXalan.sh -in elemExample.xml -xsl elemExample.xsl
<?xml version="1.0" encoding="UTF-8"?>
<input type="hidden" name="id" value="10"/>


Sri ni wrote:


I have a xml file which is like this

<Message id='10' value='one'/>

i have a xsl file which has to take this value of this attribute id and to replace with it for an hidden value.

<input type='hidden' name='id' value='<xsl:value-of select="@id"'/>>

But i am getting a transform exception how shall i achieve the same??.

I want to replace the value 10 in my hidden attribute ( note this is just an example i will this id in the fly ONLY).

Can anyone please please help me out.

Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

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

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.