2 Replies Latest reply on Nov 19, 2008 6:35 AM by sotospeak (carlo bazzo)

    XML and Layers (sorry for long post)

    sotospeak (carlo bazzo)
      I do not have a clear understanding about the way Indesign interracts with layers and Xml content and I did not find much reference about it.

      My case:
      I have "layerA" active in MyDocument and I tag some texts (which are only on that layerA) creating an xml structure which subsequently I export in an xml "test" file.

      After that, I fill my xml "test" file with some content (in the real I created a script which merges this file with a "price list" xml file but this is unimportant here). Before importing my filled xml file in MyDocument, I duplicate "layerA" into a new "layerB": if I lock "layerA" I (ingenuously) thought that importing the xml content would have affected just the tagged texts in layerB and, the other way, if I lock layerB it would affect just "layerA" tagged content.

      Unfortunately Indesign does not share my point of view. When I import my xml file Indesign with "layerA" locked (the originally tagged layer) Indesign warns that he can not operate on a layer locked and I have to unlock. If I unlock both layerA and layerB Indesign fills layerA alone with xml content leaving the tagged content in layerB (the duplicated layer) empty.

      Trying to understand this behaviour, I set the option to view my xml structure in MyDocument and I understood what happens: when I duplicate my tagged layerA into a new layerB, Indesign "duplicates" also my xml structure so that if I have 10 elements before I have now 20 elements after duplicating layerA.

      The problem is this: when Indesign duplicates xml elements in the structure it puts the new elements (the "layerB" elements) after the old ones (the original "layerA" elements). So when importing my xml file (which has only 10 elements! that is to say the layerA elements) as Indesign follows the structure top-bottom it warns that it can not "update" the layerA elements (which are the uppermost ones) because layerA is locked.

      After this (boring) introduction I would ask forum members any ideas to perform this task:

      1-I would like to tag 1 layer (Italian price-list for example)
      2- Duplicate that layer many times as my price-lists (German price-list, American price-list etc)
      3- Import, say the american price-list xml having just the American price-list layer affected and the others untouched.

      I would appreciate if you would share your view, thank you

      carlo
        • 1. Re: XML and Layers (sorry for long post)
          Hi Carlo,

          I'm afraid it doesn't work the way you need it.

          At the moment the only alternative I see, is to change your workflow.

          You might change your template file, so that a layer for every price list exist. In the next step you create a XML file where the date for each list is contained. Then you can connect each frame in every layer with a corresponding xml element.

          The problem is, that you can only have a single XML file in your structure view at a time. So in that file you need to put the data for every single price list.
          If you want to update only one list you need to import a file where the other lists are included as well, even if their values haven't changed.

          Regards
          Silo
          • 2. Re: XML and Layers (sorry for long post)
            sotospeak (carlo bazzo) Level 1
            Thank you for your suggestion, I also think that a change in my workflow is necessary.

            I think a better way to work with xml and layers should be implemented in the future releases of Indesign.

            I think there should be a method, for example, to get the "parent layer" of an xml element. At present, in my knowledge, parsing the xml exported from an Indesign document you have no way to know which layer an xml element belongs to and this could be useful to arrange xml elements dinamically when users activate one particular layer.

            carlo