1 minute read
Synchronizing the Child Element Order with the Output Order in the Styles
Synchronizing the Child Element Order with the Output Order in the Styles
As mentioned above, the output order of child elements can be configured independently of the order the child elements are actually attached in the data. (The data order is typically based on the order the elements are specified in the DTD in the child elements list. One exception to this is when “PCDATA” is enabled for the parent element, then the order of child elements is based on the order they’re specified by the user in the Tree View - this is a limitation of XML DTD’s.) The advantage of specifying output orders independently of the DTD order for child elements, is that it is more flexible and powerful, as it allows you to intermingle attributes of the element with child elements in the Preview / output generating system, e.g. "Attr1, ChildElem1, Attr2, ChildElem2". However, the disadvantage is that this creates a bit more maintenance work when configuring the DTD, as when you change the DTD order of child elements, you have to manually also change the output order specification in the Styles. In this case, the “Synchronize output order in styles” commands can be used to mitigate this, by automatically synchronizing the output order with the DTD order of child elements. These commands can be activated by right-clicking on the list of allowed child elements in the DTD editor.
Advertisement
These commands will try set the output order of child elements to be the same as their ordering in the 'allowed child elements' list. The first command does it for the selected element only, while the second does it for all elements in the DTD.
33. Figure: DTD editor child element list right-click menu, with "Synchronize output order in styles" commands