By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,377 Members | 1,722 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,377 IT Pros & Developers. It's quick & easy.

Modify the XLST DOM

P: n/a
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:output 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

Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
mike wrote:
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:output 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);

Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.