Subject: RE: attribute problem
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Tue, 11 Sep 2001 17:41:02 +0100
|
> I am writing a xsl stylesheet for adding attribute to the
> element but facing
> problems .I need to take the attribute(name value) as wel as
> element name as
> a parameter from the user.Can anybody tell me how should I
> achieve this?
Declare global parameters in your stylesheet:
<xsl:param name="elname"/>
<xsl:param name="attname"/>
Then write something like
<xsl:template match="*">
<xsl:if test="name() = $elname">
<xsl:copy>
<xsl:attribute name="{$attname}">new value</xsl:attribute>
<xsl:apply-templates/>
</xsl:copy>
</xsl:if>
</xsl:template>
Mike Kay
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
- attribute problem
- Praveg - Tue, 11 Sep 2001 11:24:28 -0400 (EDT)
- Michael Kay - Tue, 11 Sep 2001 12:46:30 -0400 (EDT) <=
- Praveg - Wed, 12 Sep 2001 08:05:02 -0400 (EDT)
|
|