<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML dir=ltr><HEAD><TITLE>Having problems duplicating nodes</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16735" name=GENERATOR>
<STYLE>font-face {
        FONT-FAMILY: SimSun
}
font-face {
        FONT-FAMILY: SimSun
}
font-face {
        FONT-FAMILY: Calibri
}
font-face {
        FONT-FAMILY: Tahoma
}
font-face {
        FONT-FAMILY: Verdana
}
font-face {
        
}
P.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman","serif"
}
LI.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman","serif"
}
DIV.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman","serif"
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline
}
A:visited {
        COLOR: purple; TEXT-DECORATION: underline
}
SPAN.MsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline
}
SPAN.EmailStyle17 {
        COLOR: #1f497d; FONT-FAMILY: "Calibri","sans-serif"
}
.MsoChpDefault {
        FONT-SIZE: 10pt
}
DIV.Section1 {
        page: Section1
}
</STYLE>
</HEAD>
<BODY lang=EN-GB vLink=purple link=blue>
<DIV dir=ltr align=left><SPAN class=917005522-08122008><FONT face=Verdana 
color=#0000ff size=2>That's pretty much what my xml file looks 
like:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=917005522-08122008><FONT face=Verdana 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=917005522-08122008><FONT face=Verdana 
color=#0000ff size=2>&lt;quiz&gt;</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=917005522-08122008><FONT face=Verdana 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=917005522-08122008><FONT face=Verdana 
color=#0000ff size=2>&nbsp;&lt;question lesson="1"&gt;</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=917005522-08122008>&nbsp;&nbsp;&nbsp; <FONT 
face=Verdana color=#0000ff size=2>&lt;prompt&gt;This is the question to display 
on the screen.&lt;/prompt&gt;</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=917005522-08122008>&nbsp;&nbsp;&nbsp; <FONT 
face=Verdana color=#0000ff size=2>&lt;answer correct="false"&gt;This is a wrong 
answer to the question.&lt;/answer&gt;</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=917005522-08122008>&nbsp;&nbsp;&nbsp; <FONT 
face=Verdana color=#0000ff size=2>&lt;answer correct="true"&gt;This is the 
answer you should have selected.&lt;/answer&gt;</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=917005522-08122008><FONT face=Verdana 
color=#0000ff size=2>&nbsp;&lt;/question&gt;</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=917005522-08122008><FONT face=Verdana 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=917005522-08122008><FONT face=Verdana 
color=#0000ff size=2>&nbsp;&lt;!-- more questions follow 
--&gt;</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=917005522-08122008><FONT face=Verdana 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=917005522-08122008><FONT face=Verdana 
color=#0000ff size=2>&lt;/quiz&gt;</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=917005522-08122008><FONT face=Verdana 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=917005522-08122008><FONT face=Verdana 
color=#0000ff size=2>And each lesson is in its own framework, with a wrap up 
section at the end that should display the questions and answers (untracked in 
the lessons) for just that lesson. I'm not using any page templates, and each 
page of the wrap up will be the same (hence the duplicate() I've been trying to 
use to duplicate the nodes). Once the user has completed all of the lessons, the 
Test button becomes enabled, and should present them with all of the questions, 
randomized. They must pass that test to get a certificate.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=917005522-08122008><FONT face=Verdana 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=917005522-08122008><FONT face=Verdana 
color=#0000ff size=2>P</FONT></SPAN></DIV><BR>
<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>Julian 
  Tenney<BR><B>Sent:</B> Monday, December 08, 2008 2:52 PM<BR><B>To:</B> Xerte 
  discussion list<BR><B>Subject:</B> RE: [Xerte] Having problems duplicating 
  nodes<BR></FONT><BR></DIV>
  <DIV></DIV>
  <DIV id=idOWAReplyText56773 dir=ltr>
  <DIV dir=ltr><FONT face=Arial color=#000000 size=2>how fussy are you about the 
  .xml format?</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV dir=ltr><FONT face=Arial size=2>could you work with:</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV dir=ltr><FONT face=Arial size=2>&lt;questions&gt;</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV dir=ltr><FONT face=Arial size=2>&nbsp; &lt;question 
  section="1"&gt;</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; &lt;!--data for 
  question here --&gt;</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2>&nbsp; &lt;/question&gt;</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV dir=ltr><FONT face=Arial size=2>&nbsp; &lt;!--etc--&gt;</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV dir=ltr><FONT face=Arial size=2>&lt;/questions&gt;</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV dir=ltr><FONT face=Arial size=2>and generally, what does the .rlo need to 
  do? Present a framework of content for each section, and then show the quiz 
  (on the last page?). Do the page types vary?</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV dir=ltr><FONT face=Arial size=2>and then a final section 
  framework&nbsp;summarises and then shows all questions, 
  randomised?</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV></DIV>
  <DIV dir=ltr><BR>
  <HR tabIndex=-1>
  <FONT face=Tahoma size=2><B>From:</B> xerte-bounces@lists.nottingham.ac.uk on 
  behalf of Paul Swanson<BR><B>Sent:</B> Mon 08/12/2008 19:15<BR><B>To:</B> 
  Xerte discussion list<BR><B>Subject:</B> RE: [Xerte] Having problems 
  duplicating nodes<BR></FONT><BR></DIV>
  <DIV dir=ltr>
  <DIV dir=ltr align=left><SPAN class=703430319-08122008><FONT face=Verdana 
  color=#0000ff size=2>Commenting out the two randomQuizData lines doesn't 
  change anything. I've moved the statement that randomizes the questions to the 
  button that launches the final test, rather than have it in the setup 
  script.</FONT></SPAN></DIV>
  <DIV dir=ltr align=left><SPAN class=703430319-08122008><FONT face=Verdana 
  color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
  <DIV dir=ltr align=left><SPAN class=703430319-08122008><FONT face=Verdana 
  color=#0000ff size=2>Maybe I'm just going about this entirely the wrong way. 
  What I want to accomplish is to have all my test questions within one 
  setup.xml file. I have six lessons, and some of the questions will also be 
  presented at the end of each lesson. So I need to parse which questions are 
  for lesson 1, which are for lesson 2, etc. Once the student has completed all 
  of the lessons, they must take a test to pass the course. This test will be 
  comprised of all of the questions for all of the lessons, with the questions 
  randomized. Am I on the right track with what I've been trying to do, or do I 
  need to take a different approach?</FONT></SPAN></DIV>
  <DIV dir=ltr align=left><SPAN class=703430319-08122008><FONT face=Verdana 
  color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
  <DIV dir=ltr align=left><SPAN class=703430319-08122008><FONT face=Verdana 
  color=#0000ff size=2>Paul</FONT></SPAN></DIV><BR>
  <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>Julian 
    Tenney<BR><B>Sent:</B> Thursday, December 04, 2008 11:32 PM<BR><B>To:</B> 
    Xerte discussion list<BR><B>Subject:</B> RE: [Xerte] Having problems 
    duplicating nodes<BR></FONT><BR></DIV>
    <DIV></DIV>
    <DIV id=idOWAReplyText25401 dir=ltr>
    <DIV dir=ltr><FONT face=Arial color=#000000 size=2>You are creating 
    references to the same array.</FONT></DIV>
    <DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
    <DIV dir=ltr>
    <DIV dir=ltr align=left><SPAN class=980191719-04122008><FONT 
    face="Courier New" size=2>quizData = templateData.quiz[0]; // non-randomized 
    questions</FONT></SPAN></DIV>
    <DIV><FONT face="Courier New"></FONT>&nbsp;</DIV>
    <DIV dir=ltr align=left><SPAN class=980191719-04122008><FONT face=Verdana 
    size=2><FONT face="Courier New">randomQuizData = templateData.quiz[0]; // 
    for randomized questions<BR>randomQuizData.question.randomize(); // 
    randomize the list of questions</FONT>.</FONT></SPAN></DIV>
    <DIV dir=ltr align=left><SPAN class=980191719-04122008><FONT face=Verdana 
    size=2></FONT></SPAN>&nbsp;</DIV>
    <DIV dir=ltr align=left><SPAN class=980191719-04122008><FONT face=Verdana 
    size=2>quizData.question is also randomised.</FONT></SPAN></DIV></DIV></DIV>
    <DIV dir=ltr><BR>
    <HR tabIndex=-1>
    <FONT face=Tahoma size=2><B>From:</B> xerte-bounces@lists.nottingham.ac.uk 
    on behalf of Paul Swanson<BR><B>Sent:</B> Thu 04/12/2008 19:32<BR><B>To:</B> 
    Xerte discussion list<BR><B>Subject:</B> RE: [Xerte] Having problems 
    duplicating nodes<BR></FONT><BR></DIV>
    <DIV>
    <DIV dir=ltr align=left><SPAN class=980191719-04122008><FONT face=Verdana 
    color=#0000ff size=2>I think the problem is where I take the quiz part of 
    templateData and assign it to quizData:</FONT></SPAN></DIV>
    <DIV dir=ltr align=left><SPAN class=980191719-04122008><FONT face=Verdana 
    color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
    <DIV dir=ltr align=left><SPAN class=980191719-04122008><FONT 
    face="Courier New" size=2>quizData = templateData.quiz[0]; // non-randomized 
    questions</FONT></SPAN></DIV>
    <DIV><FONT face="Courier New"></FONT>&nbsp;</DIV>
    <DIV dir=ltr align=left><SPAN class=980191719-04122008><FONT face=Verdana 
    size=2><FONT face="Courier New">randomQuizData = templateData.quiz[0]; // 
    for randomized questions<BR>randomQuizData.question.randomize(); // 
    randomize the list of questions</FONT>.<BR></FONT></SPAN></DIV>
    <DIV dir=ltr align=left><SPAN class=980191719-04122008><FONT face=Verdana 
    color=#0000ff size=2>All of the questions are between the &lt;quiz&gt; 
    &lt;/quiz&gt; tags, and there is only one set of those. To indicate which 
    lesson the question is for, I have an attribute for the &lt;question&gt; tag 
    (lesson="1", lesson="2", etc.). Then I try to get just the lesson 1 
    questions with:</FONT></SPAN></DIV>
    <DIV dir=ltr align=left><SPAN class=980191719-04122008><FONT face=Verdana 
    color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
    <DIV dir=ltr align=left><SPAN class=980191719-04122008><FONT 
    face="Courier New" size=2>// create arrays for lesson 1 quiz<BR>lesson1quiz 
    = new Array ();<BR>wrapupQbuilt = new Array (); // for 
    questions<BR>wrapupBuilt = new Array (); // for question 
    answers<BR>wrapupTracking = new Array ();<BR>wrapupAnswers = new Array 
    ();</FONT></SPAN></DIV>
    <DIV><FONT face="Courier New"></FONT>&nbsp;</DIV>
    <DIV dir=ltr align=left><SPAN class=980191719-04122008><FONT 
    face="Courier New" size=2>lesson1Counter = 0; // counter for number of 
    questions</FONT></SPAN></DIV>
    <DIV><FONT face="Courier New"></FONT>&nbsp;</DIV>
    <DIV dir=ltr align=left><SPAN class=980191719-04122008><FONT 
    face="Courier New" size=2>// loop through all questions to get lesson 
    1<BR>for (i = 0; i &lt; quizData.question.length; i++) {</FONT></SPAN></DIV>
    <DIV><FONT face="Courier New"></FONT>&nbsp;</DIV>
    <DIV dir=ltr align=left><SPAN class=980191719-04122008><FONT 
    face="Courier New" size=2>&nbsp; if (quizData.question[i].lesson == '1') 
    {<BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp; lesson1quiz[lesson1Counter].question = 
    quizData.question[i];<BR>&nbsp;&nbsp;&nbsp; 
    lesson1Counter++;</FONT></SPAN></DIV>
    <DIV><FONT face="Courier New"></FONT>&nbsp;</DIV>
    <DIV dir=ltr align=left><SPAN class=980191719-04122008><FONT 
    face="Courier New" size=2>&nbsp; } // end of quizData.question[i] 
    conditional</FONT></SPAN></DIV>
    <DIV><FONT face="Courier New"></FONT>&nbsp;</DIV>
    <DIV dir=ltr align=left><SPAN class=980191719-04122008><FONT 
    face="Courier New" size=2>&nbsp; myCounter = i + 1;</FONT></SPAN></DIV>
    <DIV><FONT face="Courier New"></FONT>&nbsp;</DIV>
    <DIV dir=ltr align=left><SPAN class=980191719-04122008><FONT 
    face="Courier New" size=2>} // end of for loop</FONT></SPAN></DIV>
    <DIV><FONT face="Courier New"></FONT>&nbsp;</DIV>
    <DIV dir=ltr align=left><SPAN class=980191719-04122008><FONT 
    face="Courier New" size=2>// create the right number of questions<BR>if 
    (wrapupQbuilt[lesson1Counter] != 'true') {<BR>&nbsp; 
    icon.nextSibling.childNodes[6].childNodes[0].childNodes[2].childNodes[0].childNodes[1].duplicate(lesson1Counter-1);<BR>}<BR>wrapupQbuilt[lesson1Counter] 
    = 'true';</FONT></SPAN></DIV>
    <DIV><SPAN class=980191719-04122008><FONT face=Verdana color=#0000ff 
    size=2></FONT></SPAN>&nbsp;</DIV>
    <DIV><SPAN class=980191719-04122008><FONT face=Verdana color=#0000ff 
    size=2>But when I print lesson1quiz.length for debugging purposes, it prints 
    0, I was expecting it to print 2. Yet if I hard code the index of the 
    lesson1quiz to get a question, it does appear. Hard code 0 and it pulls the 
    second question, hard code 1 and it prints the first question (backwards 
    from what I expected, but the order isn't important), so there must be 
    something in the lesson1quiz array.</FONT></SPAN></DIV>
    <DIV><SPAN class=980191719-04122008><FONT face=Verdana color=#0000ff 
    size=2></FONT></SPAN>&nbsp;</DIV>
    <DIV><SPAN class=980191719-04122008><FONT face=Verdana color=#0000ff 
    size=2>Paul</DIV>
    <DIV dir=ltr align=left><BR></DIV></FONT></SPAN><BR>
    <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>Julian 
      Tenney<BR><B>Sent:</B> Thursday, December 04, 2008 12:58 AM<BR><B>To:</B> 
      Xerte discussion list<BR><B>Subject:</B> RE: [Xerte] Having problems 
      duplicating nodes<BR></FONT><BR></DIV>
      <DIV></DIV>
      <DIV class=Section1>
      <P class=MsoNormal><SPAN 
      style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">What 
      you describe sounds right. I think the index is correct (and that&#8217; backed 
      up by the fact you use the same var to display the current page number to 
      the user).</SPAN></P>
      <P class=MsoNormal><SPAN 
      style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"></SPAN>&nbsp;</P>
      <P class=MsoNormal><SPAN 
      style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">So 
      if that is indeed correct, then it must be an issue with reading the data 
      out of the xml data. Are you using th index in the right part of the 
      templateData path?</SPAN></P>
      <P class=MsoNormal><SPAN 
      style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"></SPAN>&nbsp;</P>
      <DIV>
      <DIV 
      style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0cm; BORDER-TOP: #b5c4df 1pt solid; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: medium none; PADDING-TOP: 3pt; BORDER-BOTTOM: medium none">
      <P class=MsoNormal style="MARGIN-LEFT: 36pt"><B><SPAN lang=EN-US 
      style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'">From:</SPAN></B><SPAN 
      lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'"> 
      xerte-bounces@lists.nottingham.ac.uk 
      [mailto:xerte-bounces@lists.nottingham.ac.uk] <B>On Behalf Of </B>Paul 
      Swanson<BR><B>Sent:</B> Wednesday, December 03, 2008 10:04 
      PM<BR><B>To:</B> Xerte discussion list<BR><B>Subject:</B> RE: [Xerte] 
      Having problems duplicating nodes</SPAN></P></DIV></DIV>
      <P class=MsoNormal style="MARGIN-LEFT: 36pt">&nbsp;</P>
      <P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN 
      style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Verdana','sans-serif'">Well, 
      apparently I was. I had the duplicate code in the entry frame of lesson 1, 
      so I guess it was executing each time I moved from page to page in lesson 
      1? I moved the code to just above the interface icon (so it can only run 
      once), made the necessary changes to the childNodes structure, and it was 
      still acting funny. I then found that I had both a variable and an icon id 
      of 'lesson1Counter' so it's no wonder it was acting inconsistently. 
      ;o)&nbsp; I fixed that and now I'm consistently getting the correct number 
      of question nodes.</SPAN></P>
      <P class=MsoNormal style="MARGIN-LEFT: 36pt">&nbsp;</P>
      <P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN 
      style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Verdana','sans-serif'">I 
      still have one problem though: it only displays one question. When I get 
      to the first question node, it displays the question correctly, the second 
      node displays the same question, and if I back up to the first question 
      node, it's blank.&nbsp; Here is the code where I get the question 
      number:</SPAN></P>
      <P class=MsoNormal style="MARGIN-LEFT: 36pt">&nbsp;</P>
      <P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN 
      style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">questIndex 
      = icon.parentNode.index() - 1;</SPAN></P>
      <P class=MsoNormal style="MARGIN-LEFT: 36pt">&nbsp;</P>
      <P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN 
      style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Verdana','sans-serif'">The 
      script icon with this code is the first icon in the proto Wrap Up page 
      (what I was calling the question node above), and the proto Wrap Up page 
      is&nbsp;the second&nbsp;child of the wrap up framework (the Entry Frame 
      being the first child), so questIndex should be 0 for the first question, 
      and 1 for the next, right? I'm using questIndex+1 for a page counter, and 
      that is correctly displaying 1 for question 1 and 2 for question 2, but 
      the questions don't change. Any insight on that?</SPAN></P>
      <P class=MsoNormal style="MARGIN-LEFT: 36pt">&nbsp;</P>
      <P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN 
      style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Verdana','sans-serif'">Thanks 
      for all your help!</SPAN></P>
      <P class=MsoNormal style="MARGIN-LEFT: 36pt">&nbsp;</P>
      <P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN 
      style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Verdana','sans-serif'">P</SPAN></P>
      <BLOCKQUOTE 
      style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0cm; BORDER-TOP: medium none; PADDING-LEFT: 4pt; PADDING-BOTTOM: 0cm; MARGIN: 5pt 0cm 5pt 3.75pt; BORDER-LEFT: blue 1.5pt solid; PADDING-TOP: 0cm; BORDER-BOTTOM: medium none">
        <P class=MsoNormal style="MARGIN-LEFT: 36pt">&nbsp;</P>
        <DIV class=MsoNormal style="MARGIN-LEFT: 36pt; TEXT-ALIGN: center" 
        align=center><SPAN lang=EN-US>
        <HR align=center width="100%" SIZE=2>
        </SPAN></DIV>
        <P class=MsoNormal 
        style="MARGIN-BOTTOM: 12pt; MARGIN-LEFT: 36pt; MARGIN-RIGHT: 0cm"><B><SPAN 
        lang=EN-US 
        style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'">From:</SPAN></B><SPAN 
        lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'"> 
        xerte-bounces@lists.nottingham.ac.uk 
        [mailto:xerte-bounces@lists.nottingham.ac.uk] <B>On Behalf Of </B>Julian 
        Tenney<BR><B>Sent:</B> Wednesday, December 03, 2008 12:45 
        PM<BR><B>To:</B> Xerte discussion list<BR><B>Subject:</B> RE: [Xerte] 
        Having problems duplicating nodes</SPAN><SPAN lang=EN-US></SPAN></P>
        <DIV id=idOWAReplyText71498>
        <DIV>
        <P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN 
        style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'">You're 
        not duplicating icons more than once are you? When you call duplicate, 
        you are manipulatingthe xml in the rlo file:</SPAN></P></DIV>
        <DIV>
        <P class=MsoNormal style="MARGIN-LEFT: 36pt">&nbsp;</P></DIV>
        <DIV>
        <P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN 
        style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">//this makes 
        n + 1 children on icon.nextSibling:</SPAN></P></DIV>
        <DIV>
        <P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN 
        style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">icon.nextSibling.firstChild.duplicate(n);</SPAN></P></DIV>
        <DIV>
        <P class=MsoNormal style="MARGIN-LEFT: 36pt">&nbsp;</P></DIV>
        <DIV>
        <P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN 
        style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">//call it 
        again (perhaps because we revisit this page):</SPAN></P></DIV>
        <DIV>
        <P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN 
        style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">icon.nextSibling.firstChild.duplicate(n);</SPAN></P></DIV>
        <DIV>
        <P class=MsoNormal style="MARGIN-LEFT: 36pt">&nbsp;</P></DIV>
        <DIV>
        <P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN 
        style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">//how many 
        children?</SPAN></P></DIV>
        <DIV>
        <P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN 
        style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">debug(icon.nextSibling.childNodes.length); 
        //duh. Twice as many as I needed.</SPAN></P></DIV>
        <DIV>
        <P class=MsoNormal style="MARGIN-LEFT: 36pt">&nbsp;</P></DIV>
        <DIV>
        <P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN 
        style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">//so, only 
        let the duplicate run once, 'cos if we revisit a page, we'll end up with 
        too many xml nodes...</SPAN></P></DIV>
        <DIV>
        <P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN 
        style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">if (someFlag 
        != true){</SPAN></P></DIV>
        <DIV>
        <P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN 
        style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp; 
        duplicate(....make icons here...);</SPAN></P></DIV>
        <DIV>
        <P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN 
        style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp; 
        someFlag = true;</SPAN></P></DIV>
        <DIV>
        <P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN 
        style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">}</SPAN></P></DIV>
        <DIV>
        <P class=MsoNormal style="MARGIN-LEFT: 36pt">&nbsp;</P></DIV>
        <DIV>
        <P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN 
        style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">//i tend to 
        do it like this, so duplicate code in icon will only ever run 
        once:</SPAN></P></DIV>
        <DIV>
        <P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN 
        style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">if 
        (icon.attributes.built != 'true'){</SPAN></P></DIV>
        <DIV>
        <P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN 
        style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp; 
        //duplicate and other logic here</SPAN></P></DIV>
        <DIV>
        <P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN 
        style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">&nbsp; 
        icon.attributes.built = 'true';</SPAN></P></DIV>
        <DIV>
        <P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN 
        style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">}</SPAN></P></DIV>
        <DIV>
        <P class=MsoNormal style="MARGIN-LEFT: 36pt">&nbsp;</P></DIV>
        <DIV>
        <P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN 
        style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">sort that out 
        and the see if you've got any issues left. The thing is that 'icon' 
        refers to the underlying xml node - that is key to understanding what's 
        happening with duplicate(); make sure the code that builds the piece 
        only runs once.</SPAN></P></DIV>
        <DIV>
        <P class=MsoNormal style="MARGIN-LEFT: 36pt">&nbsp;</P></DIV>
        <DIV>
        <P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN 
        style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">J</SPAN></P></DIV></DIV>
        <DIV>
        <P class=MsoNormal 
      style="MARGIN-LEFT: 36pt">&nbsp;</P></DIV></BLOCKQUOTE></DIV></BLOCKQUOTE></DIV></BLOCKQUOTE></DIV></BLOCKQUOTE></BODY></HTML>