Home › Forums › General XMetaL Discussion › CSS set specific style to second child element › Reply To: CSS set specific style to second child element
Reply to: CSS set specific style to second child element
December 21, 2017 at 8:35 pmThis type of selector isn't supported. The following would do it but only for this specific case:
msub > mi mi {
vertical-align: sub
}
That's going to affect all
If you are going to have content where there are more than two
[code]//XMetaL Script Language JScript:
//create a Range we can move around to alter style(s) for specific elements
var rng = ActiveDocument.Range;
//get all nodes that are the second mi sibling inside msub:
var nodes = ActiveDocument.getNodesByXPath(“//msub/mi[2]”);
//loop through the list of nodes, move the Range to each, and set the style(s):
for(i=0; i
rng.ContainerStyle = “display:inline; vertical-align:sub; font-size:0.8em”;
}[/code]
Note to anyone that wants to use this approach for DITA: Please don't try. Modifying the DITA customization's scripts is not supported.
Regarding MathML:
If you are trying to style MathML to make it easier to edit in XMetaL Author I think that's going to be a lot of work unless you use a very small specific subset and perhaps only use some specific equation layouts. If you use MathML on a regular basis I would highly recommend Design Science's “MathFlow Editor” for XMetaL Author (it works with XMAX as well): https://www.dessci.com/en/products/mathflow/mf_for_xmetal.htm