3 Replies Latest reply on Oct 9, 2008 2:45 PM by (charles_darwin)

    Find and change via xml tag

    Level 1
      help please! we are having a hard time renumbering the references automatically. is there a script that could find xml tags and replace its content? thanks.
      i'm using indesign cs2, windows xp home sp2
        • 1. Re: Find and change via xml tag
          Level 1
          Hi charles darwin,

          What you want to find is an XML element given its XML tag, then change something in the text content of the element. But it's hard to know exactly how to do that if we don't know anything about the structure of your XML. It could be really simple, and it could be really hard. Tell us more!

          Also, I love your work. "The Origin of Species" is one of my favorite works. But...aren't you a little, er, dead? I mean, one is never too old to learn InDesign....

          Thanks,

          Ole
          • 2. Re: Find and change via xml tag
            Level 1
            hi ole, <br />i'm back to republish my "The Origin of Species" using indesign. just kidding.<br /><br />The serious part is i have this simple structure:<br /><ref>1</ref><br /><ref>2</ref><br /><ref>3</ref><br /><br />then the author decided that he wants the ref1 to become ref2 and then ref3 to become ref1. is there a script that could find the tag <ref> containing "1" and replace it with "2" in all the citations in the body?<br /><br />i have a meeting with my boss and he will ask me regarding this so please your help would be highly appreciated.
            • 3. Re: Find and change via xml tag
              Level 1
              i found this script from Peter Kahrel

              if ( app.selection[0].constructor.name == 'InsertionPoint'
              && app.activeDocument.characterStyles.item ('ref') != null )
              {
              app.selection[0].appliedCharacterStyle = 'ref';
              app.selection[0].contents = '1'
              }

              since my xml tag was mapped with my character style. i could just find the character style (ref) containing '1' and replace it with '2'. can you help me improve this script?

              thanks.