<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML dir=ltr><HEAD><TITLE>Making a page counter in Xerte 1.8</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16544" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face=Verdana color=#0000ff size=2><SPAN 
class=167244120-30102007>Yep, it's working now. I had actually tried index(), 
but had one too many parentNode references, and it was returning zero. I 
stumbled on index() kind of accidentally. childIndex() returned "NaN" ('Not a 
Number' for those who aren't familiar with NaN), so, out of despiration, I just 
changed it to index(); not expecting it to work. But it returned a number, it's 
just that it was the same number no matter what page I inserted it on. I now 
know that I had one too many parentNode references, and it was correctly 
returning the index number of the framework icon itself. My working code 
is:</SPAN></FONT></DIV>
<DIV><FONT face=Verdana color=#0000ff size=2><SPAN 
class=167244120-30102007></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Verdana size=2><SPAN 
class=167244120-30102007>slideCounter.setText('Slide ' + icon.parentNode.index() 
+ ' of ' + (icon.parentNode.parentNode.childNodes.length - 
1));</SPAN></FONT></DIV>
<DIV><FONT face=Verdana color=#0000ff size=2><SPAN 
class=167244120-30102007></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Verdana color=#0000ff size=2><SPAN 
class=167244120-30102007>Since the first node of the framework is an Entry Frame 
icon, I don't need to add 1 to the index to get the content page number, but I 
do need to subtract 1 from the length. I can copy this to each content page in a 
framework, and it will correctly print "Slide x of y". No icon references 
needed.</SPAN></FONT></DIV>
<DIV><FONT face=Verdana color=#0000ff size=2><SPAN 
class=167244120-30102007></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Verdana color=#0000ff size=2><SPAN 
class=167244120-30102007>Thanks!</SPAN></FONT></DIV>
<DIV><FONT face=Verdana color=#0000ff size=2><SPAN 
class=167244120-30102007>Paul</SPAN></FONT></DIV>
<DIV dir=ltr align=left><BR></DIV>
<BLOCKQUOTE dir=ltr 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
  <HR tabIndex=-1>
  <FONT face=Tahoma size=2><B>From:</B> xerte-bounces@lists.nottingham.ac.uk 
  [mailto:xerte-bounces@lists.nottingham.ac.uk] <B>On Behalf Of </B>Tenney 
  Julian<BR><B>Sent:</B> Tuesday, October 30, 2007 12:44 PM<BR><B>To:</B> Xerte 
  discussion list<BR><B>Subject:</B> RE: [Xerte] Making a page counter in Xerte 
  1.8 - Solved<BR></FONT><BR></DIV>
  <DIV></DIV>
  <DIV id=idOWAReplyText88977 dir=ltr>
  <DIV dir=ltr><FONT face=Arial color=#000000 size=2>You can do xmlNode.index() 
  which will return the index of the node. </FONT><FONT face=Arial 
  size=2></FONT></DIV>
  <DIV dir=ltr><FONT face=Arial 
size=2>Julian</FONT></DIV></DIV></BLOCKQUOTE></BODY></HTML>