docs: function(layer) {
          var node = this.createElementDefaultNS("StyleList");
  
          var styles = layer.styles;
          if (styles && OpenLayers.Util.isArray(styles)) {
              var sld;
              for (var i=0, len=styles.length; i<len; i++) {
                  var s = styles[i];
                  // three style types to consider
                  // [1] linked SLD
                  // [2] inline SLD
                  // [3] named style
                  // running child nodes always gets name, optionally gets href or body
                  var style = this.createElementDefaultNS(
                      "Style",
                      null,
                      (s.current && s.current == true) ?
                      {current: "1"} : null
                  );
                  if(s.href) { // [1]
                      sld = this.createElementDefaultNS("SLD");
                       // Name is optional.
                       if (s.name) {
                      sld.appendChild(this.createElementDefaultNS("Name", s.name));
                       }
                      // Title is optional.
                      if (s.title) {
                          sld.appendChild(this.createElementDefaultNS("Title", s.title));
                      }
                       // LegendURL is optional
                       if (s.legend) {
                           sld.appendChild(this.write_wmc_URLType("LegendURL", s.legend.href, s.legend));
                       }
  
                       var link = this.write_wmc_OnlineResource(s.href);
                       sld.appendChild(link);
                      style.appendChild(sld);
                  } else if(s.body) { // [2]
                      sld = this.createElementDefaultNS("SLD");
                       // Name is optional.
                       if (s.name) {
                           sld.appendChild(this.createElementDefaultNS("Name", s.name));
                       }
                       // Title is optional.
                       if (s.title) {
                           sld.appendChild(this.createElementDefaultNS("Title", s.title));
                       }
                       // LegendURL is optional
                       if (s.legend) {
                           sld.appendChild(this.write_wmc_URLType("LegendURL", s.legend.href, s.legend));
                       }
  
                      // read in body as xml doc - assume proper namespace declarations
                      var doc = OpenLayers.Format.XML.prototype.read.apply(this, [s.body]);
                      // append to StyledLayerDescriptor node
                      var imported = doc.documentElement;
                      if(sld.ownerDocument && sld.ownerDocument.importNode) {
                          imported = sld.ownerDocument.importNode(imported, true);
                      }
                      sld.appendChild(imported);
                      style.appendChild(sld);            
                  } else { // [3]
                      // both Name and Title are required.
                      style.appendChild(this.createElementDefaultNS("Name", s.name));
                      style.appendChild(this.createElementDefaultNS("Title", s.title));
                      // Abstract is optional
                      if (s['abstract']) { // abstract is a js keyword
                          style.appendChild(this.createElementDefaultNS(
                              "Abstract", s['abstract']
                          ));
                      }
                       // LegendURL is optional
                       if (s.legend) {
                           style.appendChild(this.write_wmc_URLType("LegendURL", s.legend.href, s.legend));
                  }
                   }
                  node.appendChild(style);
              }
          }
  
          return node;
      }