Modify the XLST DOM

M

mike

I have a stylesheet embedded in my html page like:

<xml id="xslFix">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:eek:utput method="html"/>
<xsl:param name="statusfield"></xsl:param>
......<snip>....
</xml>

I want to modify the:
<xsl:param name="statusfield"></xsl:param> node and add a text node
there so it looks like:
<xsl:param name="statusfield">stuff in here</xsl:param>

<script language="JavaScript">
var sf = new ActiveXObject("MSXML2.FreeThreadedDOMDocument.4.0");
sf.load(xslFix);
var omap = sf.documentElement.getElementsByTagName('xsl:param');
for ( var i=0; i<omap.length; i++ )
{
if ( omap.item(i).getAttribute("name") == "statusfield" )
{
myText=omap.item(i).createTextNode('stuff..');
omap.item(i).appendChild(myText);
}
}
</script>

But this does not work. I get an error message saying something about
this object not avaailable in this manner.
Any help is appreciated.

Mike
 
R

RobB

mike said:
I have a stylesheet embedded in my html page like:

<xml id="xslFix">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:eek:utput method="html"/>
<xsl:param name="statusfield"></xsl:param>
.....<snip>....
</xml>

I want to modify the:
<xsl:param name="statusfield"></xsl:param> node and add a text node
there so it looks like:
<xsl:param name="statusfield">stuff in here</xsl:param>

<script language="JavaScript">
var sf = new ActiveXObject("MSXML2.FreeThreadedDOMDocument.4.0");
sf.load(xslFix);
var omap = sf.documentElement.getElementsByTagName('xsl:param');
for ( var i=0; i<omap.length; i++ )
{
if ( omap.item(i).getAttribute("name") == "statusfield" )
{
myText=omap.item(i).createTextNode('stuff..');
omap.item(i).appendChild(myText);
}
}
</script>

But this does not work. I get an error message saying something about
this object not avaailable in this manner.
Any help is appreciated.

Mike

Believe createTextNode() is just a factory method, a member of
Document. Unlike, say, getElementsByTagName(), it's not a method of
other Node objects. Might try...

myText=document.createTextNode('stuff..');
omap.item(i).appendChild(myText);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,828
Latest member
LauraCastr

Latest Threads

Top