07-24-2023, 12:40 AM
I have the following pieces of JScript code in my XSLT:
var childAttribute1 = ppDemo1[i].firstChild.attributes;
if(childAttribute1.length != 0)
{
....
}
var childAttribute2 = ppDemo1[i].childNodes.item(0);
if(childAttribute2.nodeType != 8)
{
....
}
ppDemo1 points to a commented node/text in XML
I am trying to achieve the same thing i.e. not enter the if loop if the current node is a comment (and has no attributes)
My issue: I always get a runtime error 'Object required' at both of the 'if' clauses
Can you please tell me what is wrong in the above pieces of code
Edited:
I am using the MSXML processor
And, I can get it to work if I use:
if(ppDemo1[i].attributes)
{
...
}
var childAttribute1 = ppDemo1[i].firstChild.attributes;
if(childAttribute1.length != 0)
{
....
}
var childAttribute2 = ppDemo1[i].childNodes.item(0);
if(childAttribute2.nodeType != 8)
{
....
}
ppDemo1 points to a commented node/text in XML
I am trying to achieve the same thing i.e. not enter the if loop if the current node is a comment (and has no attributes)
My issue: I always get a runtime error 'Object required' at both of the 'if' clauses
Can you please tell me what is wrong in the above pieces of code
Edited:
I am using the MSXML processor
And, I can get it to work if I use:
if(ppDemo1[i].attributes)
{
...
}