This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Manipulation of XSL attributes
- To: "XML" <XML-INTEREST at JAVA dot SUN dot COM>, "XSL-List" <xsl-list at mulberrytech dot com>
- Subject: Manipulation of XSL attributes
- From: "ciaran byrne" <ciaran dot byrne at 3tl dot com>
- Date: Mon, 21 Aug 2000 12:59:35 +0100
- Reply-To: xsl-list at mulberrytech dot com
Hi all,
I'm having a problem with the manipulation
of attribute values as follows..
Lets say I have an element
<img src="x.bmp" alt="z.bmp" align="" hspace=""/>
and a param in my XSL called $path, which for this
example has the value "y.bmp"
My desired output is:
<img src="y.bmp" alt="z.bmp"/>
As can be seen from above I've added in the $path and removed
empty attribute values.
The problem is I'm having no joy implementing this in my XSL.
I was attempting to implement this by building up an attribute set
such as:
<xsl:attribute-set name="attributes">
<xsl:attribute name="src"><xsl:value-of select="$path"/></xsl:attribute>
<xsl:if test="string(@alt)">
<xsl:attribute name="alt"><xsl:value-of select="@alt/></xsl:attribute>
</xsl:if>
</xsl:attribute-set>
.......
<xsl:copy use-attribute-sets="attribute">
This gives me an error !!
Any ideas anyone ???
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list