    /*
     * call-seq:
     *   serialize(document)
     *
     * Serialize +document+ to an xml string.
     */
    static VALUE serialize(VALUE self, VALUE xmlobj)
    {
        xmlDocPtr xml ;
        xsltStylesheetPtr ss ;
        xmlChar* doc_ptr ;
        int doc_len ;
        VALUE rval ;

        Data_Get_Struct(xmlobj, xmlDoc, xml);
        Data_Get_Struct(self, xsltStylesheet, ss);
        xsltSaveResultToString(&doc_ptr, &doc_len, xml, ss);
        rval = NOKOGIRI_STR_NEW(doc_ptr, doc_len, xml->encoding);
        xmlFree(doc_ptr);
        return rval ;
    }