3 Replies Latest reply on Sep 10, 2016 9:55 AM by borise78101190

    XML-Import and constant number of lines

    borise78101190

      Hello community,

       

      I can't figure out a  solution for my problem.

       

      I import some XML containing addresses with XML-rule (JS):

        function addressStyling(){

              this.name = "addressStyling";

              this.xpath = "//address";

              this.apply = function(myElement, myRuleProcessor){

                  with(myElement){

                      var myAttribute = myElement.xmlContent;

                      myElement.xmlContent.applyCharacterStyle(app.activeDocument.characterStyles.item("bold"), true);

                      insertTextAsContent('\r', XMLElementPosition.ELEMENT_END);

                  }

                  return false;

              }

          }

       

      The XML looks like this and unfortunately it is not structured well.

      <addresses>

           <address>

           street1&#x2029;street2&#x2029;zipcode&#x2029;place

           </address>

           <address>

           street1&#x2029;zipcode&#x2029;place

           </address>

      <addresses>

       

      My problem is, that the layout is planned for exactly 4 rows (or lines) for this address.

      Is there a InDesign-way of solving this problem or is it better to use some XSL and separate the string (e.g. by &#x2029;) into 4 separate children?

       

      Thank you for your help!