Root:
function nodeNumber( node ){ //return node number
ret = 1; //there's at least one node
nd = node.previousSibling;
while( nd ){
if( nd.nodeTypeString == "attribute" ) //there's at least one attr
ret = ret + ((node.parentNode).attributes).length; //actual count
else
ret = ret + 1; //one more node
nd = nd.previousSibling; //check previous
}
return( ret );
}
function attrNumber( attr, element ){ //return attribute number
map = element.attributes;
total = map.length;
for( item = 0; item != total; ++item ) //find attribute by name
if( map.item( item ).nodeName == attr.nodeName )
return( item + 1 ); //found!
return( 0 ); //shouldn't happen
}
nodeNumber( this ).nodeNumber( this )
Element 'this.nodeName'
(this.nodeName,this.nodeName):
EMPTY nodeNumber( this ).attrNumber( this, this.selectSingleNode("..") )
Attribute 'this.nodeName'
(this.nodeName,this.nodeName):
{} nodeNumber( this ).nodeNumber( this )
Comment
(this.nodeName,this.nodeName):
{} nodeNumber( this ).nodeNumber( this )
Proc. Inst.
'this.nodeName'
(this.nodeName,this.nodeName):
{} nodeNumber( this ).nodeNumber( this )
Text
(this.nodeName,this.nodeName):
{}