Not accessible via XPPcompo object in Perl

I am just wondering why some of the macros are "Not accessible via XPPcompo object in Perl" - in particular some of the tabular macros. In non-CSS XPP we have a PI before the <thead> element which controls the <?tblwidth?> and <?setctr?> values, calculated on the fly by composition by using things that have earlier been stored (wrapper around the <table> element) - but this can't be done in the same way in CSS because of the above statement. Is there a technical reason why these can't be activated and/or are there any plans to activate these in the future (I can begin to see what my first Wish List item will be in Miami).

  • Chris,

    How are trying to use the macros you are talking about?

    Xyperl?
    The only macros that are available through the $X->macroname() interface are the ones that are in the official xymacro documentation.
    If you have your own set of macros that you want to use using xyperl, you can still insert those as regular PIs in the $X->set_text().

    CSS content function?
    You can call any macro directly in the CSS content field by using the following construction:
    content: -xpp-perl(xymacro, mymacroname, arg1, ...);

    PI in document?
    And also remember that you can still insert PI's in the base document that you are composing.
    If the system can not find a xyperl function with the same name, it will then look in the xx spec to see if it can find a macro with that name.
  • This is what I am trying to do! $bsx and $align_indent are defined as a global variables earlier - and its giving the correct value - I can use $X->set_text("$remain_meas") - if I place the <?tblwidth;140000?> direct into the text it works but I want the "140000" to be calculated dependent on "other variables" by composition (hence it will be more difficult to add via a script before processing). The function will also require the line:
    $X->setctr("$table_width"); # would be "right" in this case
    but I am only trying to do one thing at a time as I develop this.

    # alters default tabular xymacros to allow customised table formatting
    #--------------------------------------
    sub table_align {
    #--------------------------------------
    my $X = XPPcompo->new();
    $bsx = $X->get_var('%bsx');
    my $remain_meas = $bsx - $align_indent;
    $X->tblwidth("$remain_meas");
    }
  • <colspec colnum="3" colname="col3" colwidth="42*"></colspec><?xpp table_align?><thead>

    This is the extract from the CALS XML that is calling this - its a CSS and XyPerl copy of what we use in non-CSS jobs and have done for 16 years!
  • Chris,

    Ah now I see where you are getting the message "Not accessible via XPPcompo object in Perl" from.

    It is in the xymacro book itself!
    This means you can not use this macro through the regular $X->macroname() function.

    But you will have to do something like:

    # alters default tabular xymacros to allow customised table formatting
    #--------------------------------------
    sub table_align {
    #--------------------------------------
     my $X = XPPcompo->new();
     $bsx = $X->get_var('%bsx');
     my $remain_meas = $bsx - $align_indent;
     $X->set_text("<?tblwidth;$remain_meas?>");
    }
    

     

  • PS: for those who wonder how I got the code block in the answer above, here is how to do this:

    • switch to Rich Fomatting
    • select the yellow highlighter in the toolbar
    • select the language
    • paste or type or edit
    • hit insert
  • Ah - ok I will try that - still don't understand why some macros can be done "directly" and others via set_text - still seems like a Wish List item to me!
  • I think that SDL decided that it was not worthwhile to implement these macros in Perl as SDL thought that most of those macros would not get used in an XML/CSS enviroment (e.g begtab) as most of that functionality would be supported through the regular CALS attributes.

    I guess you just proved that maybe that logic was not entirely correct

    So your number 1 wishlist item should become:
    Please make ALL the macros that are listed in the Xymacro documentation available through the XPPcompo object
  • Wish List item 1 - Steve you have advance warning so can prepare your response! The logic is it allows us to keep the number of style bundles to a minimum but also have different results, using the same logic, in different jobs (customer has their own customers who want their own variations).