1

With PrinceXML it is possible to use string-set for one variable in one rule:

h1 { string-set: header content(); }
h2 { string-set: subheader content(); }

This is a cool thing and works great, but I want to set subheader for every h1 element, too (because not every chapter has subchapters and subheader would then contain the wrong string)

I already tried the following ideas, but they do not work:

h1 {
  string-set: header content();
  string-set: subheader content();
}
h2 { string-set: subheader content(); }

and

h1 { string-set: header content(); }
h1 { string-set: subheader content(); }
h2 { string-set: subheader content(); }

and

h1 { string-set: header,subheader content(); }
h2 { string-set: subheader content(); }



Is it possible at all to set multiple strings with one element? If yes, how?
PS.: The strings are displayed with the following rules:

@page :left {
  @top-right {
    content: string(header, first);
  }
}

@page :right {
  @top-right {
    content: string(subheader, first); 
  }
}
Maru
  • 894
  • 1
  • 12
  • 29

1 Answers1

2

maybe it's is a bit too late, but it is possible.

In my case I need an old and new attribute of one tag.

p.frontmatter-subtitle {
    string-set: mynew attr(new), myold attr(old);
}
J3ernhard
  • 252
  • 3
  • 12
  • Yes. When you set set multiple strings in one element, you must use a comma-separated list. When you use two string-set commands in one selector, the second command overwrites the first. – Hobbes Oct 16 '19 at 14:49