Hi all,

I've only just begun using XML and have run into a problemn that I can't
find a way around. Sorry in advance for the length of this post.

I want to apply an XSL file to an XML file I have that will display the result
in HTML format (so far so good). The XSL file has to insert a pair of radio
(option) buttons into the HTML to correspond with each element. The problem
is that I want to name the option buttons using the 'name' attribute of the
element, and as the value of the 'name' attribute has spaces in it I wish
to replace them with underscores. I've tried using the 'translate' function,
ie:

<input type="radio" value="0" checked="checked">
<xsl:attribute name="name">
<xsl:value-of select="translate('name',' ','_')"/>
</xsl:attribute>
</input>

but get the error; "unknown method-->'"translate('name'<--'

I've also tried writing a Javascript function:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:user="http://www.itcg-advisor.co.uk" version="1.0">
<msxsl:script language="javascript" implements-prefix="user">
<![CDATA[
function RemoveSpaces(sString){
var newString=sString.match(" ","_");
return newString;
}
]]>
</msxsl:script>

and calling it using:

<input type="radio" value="0" checked="checked">
<xsl:attribute name="name">
<xsl:value-of select="user:RemoveSpaces(name)"/>
</xsl:attribute>
</input>

but the HTML when displayed in the browser simply prints out the above function
at the top of the web-page and does not seem to get as far as attempting
to alter the value of the 'name' attribute.

I realise that this is most probably an elementary error on my part, but
if anyone out there could point out to me where I am going wrong in the above
code I'd be grateful.

Sorry about the size of this post, and thanks in advance,

Don.