RE: [xsl] Applying a template on values in attributes ?

Subject: RE: [xsl] Applying a template on values in attributes ?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 3 Aug 2005 22:06:34 +0100
> I have an html element as follows:
> 
> <input type="hidden" value="{TotalAdultFare}" />
> 
> I want to apply a template to TotalAdultFare.
> 
> If I do this by <xsl:attribute
> name="value"><xsl:call-template></xsl:call-template</xsl:attribute>
> then the problem is that the output is as follows:
> 
> <input type="hidden" value="1000"></input>
> 
> I want to avoid this somehow.. any ideas ?

Firstly "applying templates" usually means xsl:apply-templates, not
xsl:call-template, and you apply templates to a node, not to a value.

Secondly, xsl:call-template always has a name="xxx" attribute.

Thirdly, the value you get in your attribute is set by the template that you
call (or apply). If you don't want the value 1000 in there and want
something different, then change your template so it sets a different value.

Michael Kay
http://www.saxonica.com/

Current Thread