public static void printXmlElementAttributes(OutputStream stream, Cons attributes) {
    { Stella_Object item = null;
      Cons iter000 = attributes;

      for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
        item = iter000.value;
        { Surrogate testValue000 = Stella_Object.safePrimaryType(item);

          if (Surrogate.subtypeOfP(testValue000, Stella.SGT_STELLA_XML_ATTRIBUTE)) {
            { XmlAttribute item000 = ((XmlAttribute)(item));

              stream.nativeStream.print(" " + item000.surfaceForm + "=");
            }
          }
          else if (Surrogate.subtypeOfStringP(testValue000)) {
            { StringWrapper item000 = ((StringWrapper)(item));

              stream.nativeStream.print("\"");
              { boolean foundP000 = false;

                { char ch = Stella.NULL_CHARACTER;
                  String vector000 = item000.wrapperValue;
                  int index000 = 0;
                  int length000 = vector000.length();

                  loop001 : for (;index000 < length000; index000 = index000 + 1) {
                    ch = vector000.charAt(index000);
                    if (Stella.htmlCharacterNeedsQuotingP(ch)) {
                      foundP000 = true;
                      break loop001;
                    }
                  }
                }
                if (foundP000) {
                  Stella.writeHtmlQuotingSpecialCharacters(stream.nativeStream, item000.wrapperValue);
                }
                else {
                  stream.nativeStream.print(item000.wrapperValue);
                }
              }
              stream.nativeStream.print("\"");
            }
          }
          else {
            { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

              stream000.nativeStream.print("`" + testValue000 + "' is not a valid case option");
              throw ((StellaException)(StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
            }
          }
        }
      }
    }
  }