code: function transform( survey ) {
      let xformDoc;
      const xsltParams = survey.includeRelevantMsg ? {
          'include-relevant-msg': 1
      } : {};
  
      return _parseXml( survey.xform )
          .then( doc => {
              if ( typeof survey.preprocess === 'function' ) {
                  doc = survey.preprocess.call( libxmljs, doc );
              }
              return doc;
          } )
          .then( doc => {
              xformDoc = doc;
  
              return _transform( sheets.xslForm, xformDoc, xsltParams );
          } )
          .then( htmlDoc => {
              htmlDoc = _replaceTheme( htmlDoc, survey.theme );
              htmlDoc = _replaceMediaSources( htmlDoc, survey.media );
              htmlDoc = _replaceLanguageTags( htmlDoc, survey );
              if ( survey.markdown !== false ) {
                  survey.form = _renderMarkdown( htmlDoc );
              } else {
                  survey.form = _docToString( htmlDoc );
              }
  
              return _transform( sheets.xslModel, xformDoc );
          } )
          .then( xmlDoc => {
              xmlDoc = _replaceMediaSources( xmlDoc, survey.media );
              xmlDoc = _addInstanceIdNodeIfMissing( xmlDoc );
              survey.model = xmlDoc.root().get( '*' ).toString( false );
              survey.transformerVersion = pkg.version;
  
              delete survey.xform;
              delete survey.media;
              delete survey.preprocess;
              delete survey.markdown;
              delete survey.includeRelevantMsg;
              return survey;
          } );
  }
docs: Performs XSLT transformation on XForm and process the result.
  
  @param  {{xform: string, theme: string}} survey Survey object with at least an xform property
  @return {Promise}     promise