'Generates the styles.xml file'

def stylesxml(self):

    xml = StringIO()
    xml.write(_XMLPROLOGUE)
    x = DocumentStyles()
    x.write_open_tag(0, xml)
    if self.fontfacedecls.hasChildNodes():
        self.fontfacedecls.toXml(1, xml)
    self.styles.toXml(1, xml)
    a = AutomaticStyles()
    a.write_open_tag(1, xml)
    for s in self._used_auto_styles([self.masterstyles]):
        s.toXml(2, xml)
    a.write_close_tag(1, xml)
    if self.masterstyles.hasChildNodes():
        self.masterstyles.toXml(1, xml)
    x.write_close_tag(0, xml)
    return xml.getvalue()
