'Loop through the masterstyles elements, and find the automatic
styles that are used. These will be added to the automatic-styles
element in styles.xml'

def _used_auto_styles(self, segments):

    stylenamelist = []
    for top in segments:
        stylenamelist = self._parseoneelement(top, stylenamelist)
    stylelist = []
    for e in self.automaticstyles.childNodes:
        if (e.getAttrNS(STYLENS, 'name') in stylenamelist):
            stylelist.append(e)
    return stylelist
