OSDN Git Service

Merge branch 'master' into branch_0.13.0
[modchxj/mod_chxj.git] / src / chxj_xhtml_mobile_1_0.c
index 7e7556e..f7f3bec 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005-2008 Atsushi Konno All rights reserved.
+ * Copyright (C) 2005-2009 Atsushi Konno All rights reserved.
  * Copyright (C) 2005 QSDN,Inc. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -24,6 +24,7 @@
 #include "chxj_buffered_write.h"
 #include "chxj_str_util.h"
 #include "chxj_header_inf.h"
+#include "chxj_conv_z2h.h"
 
 #define GET_XHTML(X) ((xhtml_t*)(X))
 #undef W_L
@@ -97,7 +98,7 @@ static char *s_xhtml_1_0_end_textarea_tag    (void *pdoc, Node *node);
 static char *s_xhtml_1_0_start_b_tag         (void *pdoc, Node *node);
 static char *s_xhtml_1_0_end_b_tag           (void *pdoc, Node *node);
 static char *s_xhtml_1_0_chxjif_tag          (void *pdoc, Node *node);
-static char *s_xhtml_1_0_start_blockquote_tag(void *pdoc, Node *node);
+static char *s_xhtml_1_0_start_blockquote_tag (void *pdoc, Node *node);
 static char *s_xhtml_1_0_end_blockquote_tag  (void *pdoc, Node *node);
 static char *s_xhtml_1_0_start_dir_tag       (void *pdoc, Node *node);
 static char *s_xhtml_1_0_end_dir_tag         (void *pdoc, Node *node);
@@ -117,10 +118,17 @@ static char *s_xhtml_1_0_end_blink_tag       (void *pdoc, Node *node);
 static char *s_xhtml_1_0_start_marquee_tag   (void *pdoc, Node *node);
 static char *s_xhtml_1_0_end_marquee_tag     (void *pdoc, Node *node);
 static char *s_xhtml_1_0_newline_mark       (void *pdoc, Node *node);
+static char *s_xhtml_1_0_link_tag           (void *pdoc, Node *node);
+static char *s_xhtml_1_0_start_span_tag      (void *pdoc, Node *node);
+static char *s_xhtml_1_0_end_span_tag        (void *pdoc, Node *node);
+static char *s_xhtml_1_0_style_tag        (void *pdoc, Node *node);
 
 static void  s_init_xhtml(xhtml_t *xhtml, Doc *doc, request_rec *r, device_table *spec);
 static int   s_xhtml_search_emoji(xhtml_t *xhtml, char *txt, char **rslt);
 static char *s_xhtml_1_0_text_tag(void *pdoc, Node *child);
+static css_prop_list_t *s_xhtml_1_0_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
+static css_prop_list_t *s_xhtml_1_0_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
+/* pend */
 
 
 tag_handler xhtml_handler[] = {
@@ -294,6 +302,11 @@ tag_handler xhtml_handler[] = {
     s_xhtml_1_0_chxjif_tag,
     NULL,
   },
+  /* tagCHXJRAW */
+  {
+    s_xhtml_1_0_chxjif_tag,
+    NULL,
+  },
   /* tagNOBR */
   {
     NULL,
@@ -306,13 +319,13 @@ tag_handler xhtml_handler[] = {
   },
   /* tagSTYLE */
   {
-    NULL,
+    s_xhtml_1_0_style_tag,
     NULL,
   },
   /* tagSPAN */
   {
-    NULL,
-    NULL,
+    s_xhtml_1_0_start_span_tag,
+    s_xhtml_1_0_end_span_tag,
   },
   /* tagTEXT */
   {
@@ -389,6 +402,11 @@ tag_handler xhtml_handler[] = {
     s_xhtml_1_0_start_marquee_tag,
     s_xhtml_1_0_end_marquee_tag,
   },
+  /* tagLINK */
+  {
+    s_xhtml_1_0_link_tag,
+    NULL,
+  },
   /* tagNLMARK */
   {
     s_xhtml_1_0_newline_mark,
@@ -452,6 +470,10 @@ chxj_convert_xhtml_mobile_1_0(
   memset(ss,   0, srclen + 1);
   memcpy(ss, src, srclen);
 
+  if (IS_CSS_ON(xhtml.entryp)) {
+    /* current property list */
+    xhtml.css_prop_stack = chxj_new_prop_list_stack(&doc);
+  }
 #ifdef DUMP_LOG
   chxj_dump_out("[src] CHTML->XHTML", ss, srclen);
 #endif
@@ -646,6 +668,67 @@ s_xhtml_search_emoji(xhtml_t *xhtml, char *txt, char **rslt)
 }
 
 
+char *
+chxj_xhtml_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
+{
+  apr_size_t ii;
+  Doc __doc;
+  Doc *doc;
+  xhtml_t __xhtml;
+  xhtml_t *xhtml;
+  char one_byte[2];
+  char two_byte[3];
+  apr_pool_t *pool;
+
+  xhtml = &__xhtml;
+  doc   = &__doc;
+
+  DBG(r, "REQ[%X] start chxj_xhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
+  memset(doc,     0, sizeof(Doc));
+  memset(xhtml, 0, sizeof(xhtml_t));
+
+  doc->r        = r;
+  xhtml->doc  = doc;
+  xhtml->spec = spec;
+  xhtml->out  = qs_alloc_zero_byte_string(r->pool);
+  xhtml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
+  xhtml->doc->parse_mode = PARSE_MODE_CHTML;
+
+  apr_pool_create(&pool, r->pool);
+
+  chxj_buffered_write_init(pool, &doc->buf);
+
+  for (ii=0; ii<len; ii++) {
+    char *out;
+    int   rtn;
+
+    rtn = s_xhtml_search_emoji(xhtml, (char *)&src[ii], &out);
+    if (rtn) {
+      W_V(out);
+      ii+=(rtn - 1);
+      continue;
+    }
+
+    if (is_sjis_kanji(src[ii])) {
+      two_byte[0] = src[ii+0];
+      two_byte[1] = src[ii+1];
+      two_byte[2] = 0;
+      W_V(two_byte);
+      ii++;
+    }
+    else {
+      one_byte[0] = src[ii+0];
+      one_byte[1] = 0;
+      W_V(one_byte);
+    }
+  }
+  xhtml->out = chxj_buffered_write_flush(xhtml->out, &doc->buf);
+
+  DBG(r, "REQ[%X] end chxj_xhtml_emoji_eonly_converter()", (unsigned int)(apr_size_t)r);
+  return xhtml->out;
+}
+
+
 /**
  * It is a handler who processes the HTML tag.
  *
@@ -655,46 +738,29 @@ s_xhtml_search_emoji(xhtml_t *xhtml, char *txt, char **rslt)
  * @return The conversion result is returned.
  */
 static char *
-s_xhtml_1_0_start_html_tag(void *pdoc, Node *node
+s_xhtml_1_0_start_html_tag(void *pdoc, Node *UNUSED(node)
 {
   xhtml_t       *xhtml = GET_XHTML(pdoc);
-  Attr          *attr;
   Doc           *doc   = xhtml->doc;
 
   /*--------------------------------------------------------------------------*/
   /* Add XML Declare                                                          */
   /*--------------------------------------------------------------------------*/
-  W_L("<?xml version=\"1.0\" encoding=\"Windows-31J\"?>");
+  W_L("<?xml version=\"1.0\" encoding=\"Shift_JIS\"?>");
   W_NLCODE();
   /*--------------------------------------------------------------------------*/
   /* Add DocType                                                              */
   /*--------------------------------------------------------------------------*/
-  W_L("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML Basic 1.0//EN\"");
+  W_L("<!DOCTYPE html PUBLIC \"-//OPENWAVE//DTD XHTML 1.0//EN\"");
   W_NLCODE();
-  W_L(" \"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd\">");
+  W_L(" \"http://www.openwave.com/DTD/xhtml-basic.dtd\">");
   W_NLCODE();
   /*--------------------------------------------------------------------------*/
   /* start HTML tag                                                           */
   /*--------------------------------------------------------------------------*/
-  W_L("<html xmlns=\"http://www.w3.org/1999/xhtml\"");
-  /*--------------------------------------------------------------------------*/
-  /* Get Attributes                                                           */
-  /*--------------------------------------------------------------------------*/
-  for (attr = qs_get_attr(doc,node);
-       attr; 
-       attr = qs_get_next_attr(doc,attr)) {
-    char* name  = qs_get_attr_name(doc,attr);
-    char* value = qs_get_attr_value(doc,attr);
-    if (STRCASEEQ('l','L',"lang", name)) {
-      W_L(" xml:lang=\"");
-      W_V(value);
-      W_L("\"");
-    }
-    else if (STRCASEEQ('v','V',"version", name)) {
-      W_L(" version=\"-//OPENWAVE//DTD XHTML Mobile 1.0//EN\"");
-    }
-  }
-  W_L(">");
+  W_L("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"ja\" xml:lang=\"ja\">");
+
+  xhtml->start_html_flag = 1;
   return xhtml->out;
 }
 
@@ -941,11 +1007,14 @@ s_xhtml_1_0_end_base_tag(void *pdoc, Node *UNUSED(child))
 static char *
 s_xhtml_1_0_start_body_tag(void *pdoc, Node *node) 
 {
-  xhtml_t      *xhtml = GET_XHTML(pdoc);
-  Doc          *doc   = xhtml->doc;
-  Attr         *attr;
+  xhtml_t     *xhtml = GET_XHTML(pdoc);
+  Doc         *doc   = xhtml->doc;
+  Attr        *attr;
+  char        *attr_bgcolor = NULL;
+  char        *attr_text    = NULL;
+  char        *attr_link    = NULL;
+  char        *attr_style   = NULL;
 
-  W_L("<body");
   /*--------------------------------------------------------------------------*/
   /* Get Attributes                                                           */
   /*--------------------------------------------------------------------------*/
@@ -955,19 +1024,13 @@ s_xhtml_1_0_start_body_tag(void *pdoc, Node *node)
     char *name  = qs_get_attr_name(doc,attr);
     char *value = qs_get_attr_value(doc,attr);
     if (STRCASEEQ('b','B',"bgcolor", name) && value && *value) {
-      W_L(" bgcolor=\"");
-      W_V(value);
-      W_L("\"");
+      attr_bgcolor = value;
     }
     else if (STRCASEEQ('t','T',"text",name) && value && *value) {
-      W_L(" text=\"");
-      W_V(value);
-      W_L("\"");
+      attr_text = value;
     }
     else if (STRCASEEQ('l','L',"link", name) && value && *value) {
-      W_L(" link=\"");
-      W_V(value);
-      W_L("\"");
+      attr_link = value;
     }
     else if (STRCASEEQ('a','A',"alink", name)) {
       /* ignore */
@@ -975,8 +1038,69 @@ s_xhtml_1_0_start_body_tag(void *pdoc, Node *node)
     else if (STRCASEEQ('v','V',"vlink",name)) {
       /* ignore */
     }
+    else if (STRCASEEQ('s','S',"style",name) && value && *value) {
+      attr_style = value;
+    }
+  }
+
+  if (IS_CSS_ON(xhtml->entryp)) {
+    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *color_prop      = chxj_css_get_property_value(doc, style, "color");
+      css_property_t *bgcolor_prop    = chxj_css_get_property_value(doc, style, "background-color");
+      css_property_t *cur;
+      for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          attr_text = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+      for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+    }
+    if (xhtml->style) {
+      css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, xhtml->style);
+      css_selector_t *cur_sel;
+      for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
+        if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
+          css_property_t *cur;
+          for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
+            if (cur->name && strcasecmp(cur->name, "color") == 0) {
+              attr_link = apr_pstrdup(doc->pool, cur->value);
+            }
+          }
+        }
+      }
+    }
+  }
+
+  W_L("<body");
+  if (attr_bgcolor || attr_text) {
+    W_L(" style=\"");
+    if (attr_bgcolor) {
+      attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
+      W_L("background-color:");
+      W_V(attr_bgcolor);
+      W_L(";");
+    }
+    if (attr_text) {
+      attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
+      W_L("color:");
+      W_V(attr_text);
+      W_L(";");
+    }
+    W_L("\"");
+  }
+  if (attr_link) {
+    attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
+    W_L(" link=\"");
+    W_V(attr_link);
+    W_L("\"");
   }
   W_L(">");
+
   return xhtml->out;
 }
 
@@ -996,6 +1120,10 @@ s_xhtml_1_0_end_body_tag(void *pdoc, Node *UNUSED(child))
   Doc           *doc   = xhtml->doc;
 
   W_L("</body>");
+  if (IS_CSS_ON(xhtml->entryp)) {
+    chxj_css_pop_prop_list(xhtml->css_prop_stack);
+  }
+
   return xhtml->out;
 }
 
@@ -1011,10 +1139,11 @@ s_xhtml_1_0_end_body_tag(void *pdoc, Node *UNUSED(child))
 static char *
 s_xhtml_1_0_start_a_tag(void *pdoc, Node *node) 
 {
-  xhtml_t       *xhtml = GET_XHTML(pdoc);
-  Doc           *doc   = xhtml->doc;
-  request_rec   *r     = doc->r;
-  Attr          *attr;
+  xhtml_t     *xhtml = GET_XHTML(pdoc);
+  Doc         *doc   = xhtml->doc;
+  request_rec *r     = doc->r;
+  Attr        *attr;
+  char        *attr_style = NULL;
 
   W_L("<a");
   /*--------------------------------------------------------------------------*/
@@ -1031,7 +1160,7 @@ s_xhtml_1_0_start_a_tag(void *pdoc, Node *node)
       W_L("\"");
     }
     else if (STRCASEEQ('h','H',"href", name) && value && *value) {
-      value = chxj_encoding_parameter(r, value);
+      value = chxj_encoding_parameter(r, value, 1);
       if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
         value = chxj_add_cookie_parameter(r, value, xhtml->cookie);
       }
@@ -1074,8 +1203,16 @@ s_xhtml_1_0_start_a_tag(void *pdoc, Node *node)
     else if (STRCASEEQ('i','I',"irst",name)) {
       /* ignore */
     }
+    else if (STRCASEEQ('s','S',"style",name) && value && *value) {
+      attr_style = value;
+    }
   }
   W_L(">");
+
+  if (IS_CSS_ON(xhtml->entryp)) {
+    s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+  }
+
   return xhtml->out;
 }
 
@@ -1096,6 +1233,10 @@ s_xhtml_1_0_end_a_tag(void *pdoc, Node *UNUSED(child))
 
   W_L("</a>");
 
+  if (IS_CSS_ON(xhtml->entryp)) {
+    chxj_css_pop_prop_list(xhtml->css_prop_stack);
+  }
+
   return xhtml->out;
 }
 
@@ -1206,33 +1347,82 @@ s_xhtml_1_0_start_font_tag(void *pdoc, Node *node)
   xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc     *doc   = xhtml->doc;
   Attr    *attr;
-  char    *size = NULL;
-  char    *color = NULL;
+  char    *attr_color = NULL;
+  char    *attr_size  = NULL;
+  char    *attr_style = NULL;
 
-  /*=========================================================================*/
-  /* Get Attributes                                                          */
-  /*=========================================================================*/
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
   for (attr = qs_get_attr(doc,node);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
-    char *name = qs_get_attr_name(doc,attr);
+    char *name  = qs_get_attr_name(doc,attr);
     char *value = qs_get_attr_value(doc,attr);
     if (STRCASEEQ('c','C',"color",name) && value && *value) {
-      color = apr_pstrdup(doc->buf.pool, value);
+      attr_color = apr_pstrdup(doc->buf.pool, value);
     }
     else if (STRCASEEQ('s','S',"size",name) && value && *value) {
-      size = apr_pstrdup(doc->buf.pool, value);
+      /*----------------------------------------------------------------------*/
+      /* CHTML 5.0                                                            */
+      /*----------------------------------------------------------------------*/
+      attr_size = apr_pstrdup(doc->buf.pool, value);
+    }
+    else if (STRCASEEQ('s','S',"style",name) && value && *value) {
+      attr_style = apr_pstrdup(doc->buf.pool, value);
+    }
+  }
+  if (IS_CSS_ON(xhtml->entryp)) {
+    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
+      css_property_t *size_prop  = chxj_css_get_property_value(doc, style, "font-size");
+      css_property_t *cur;
+      for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          attr_color = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+      for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          attr_size = apr_pstrdup(doc->pool, cur->value);
+          if (STRCASEEQ('x','X',"xx-small",attr_size)) {
+            attr_size = apr_pstrdup(doc->pool, "1");
+          }
+          else if (STRCASEEQ('x','X',"x-small",attr_size)) {
+            attr_size = apr_pstrdup(doc->pool, "2");
+          }
+          else if (STRCASEEQ('s','S',"small",attr_size)) {
+            attr_size = apr_pstrdup(doc->pool, "3");
+          }
+          else if (STRCASEEQ('m','M',"medium",attr_size)) {
+            attr_size = apr_pstrdup(doc->pool, "4");
+          }
+          else if (STRCASEEQ('l','L',"large",attr_size)) {
+            attr_size = apr_pstrdup(doc->pool, "5");
+          }
+          else if (STRCASEEQ('x','X',"x-large",attr_size)) {
+            attr_size = apr_pstrdup(doc->pool, "6");
+          }
+          else if (STRCASEEQ('x','X',"xx-large",attr_size)) {
+            attr_size = apr_pstrdup(doc->pool, "7");
+          }
+        }
+      }
     }
   }
-  if (color) {
+
+  xhtml_flags_t *flg = (xhtml_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
+  memset(flg, 0, sizeof(*flg));
+  if (attr_color) {
     W_L("<font color=\"");
-    W_V(color);
+    W_V(attr_color);
     W_L("\">");
-    xhtml->font_color_flag++;
+    flg->font_color_flag = 1;
   }
-  if (size) {
-    xhtml->font_size_flag++;
-    switch(*size) {
+  if (attr_size) {
+    flg->font_size_flag = 1;
+    switch(*attr_size) {
     case '1': W_L("<span style=\"font-size: xx-small\">"); break;
     case '2': W_L("<span style=\"font-size: x-small\">");  break;
     case '3': W_L("<span style=\"font-size: small\">");    break;
@@ -1241,42 +1431,44 @@ s_xhtml_1_0_start_font_tag(void *pdoc, Node *node)
     case '6': W_L("<span style=\"font-size: x-large\">");  break;
     case '7': W_L("<span style=\"font-size: xx-large\">"); break;
     case '-':
-      if (*(size + 1) == '1') {
+      if (*(attr_size + 1) == '1') {
         W_L("<span style=\"font-size: small\">");
         break;
       }
-      if (*(size + 1) == '2') {
+      if (*(attr_size + 1) == '2') {
         W_L("<span style=\"font-size: x-small\">");
         break;
       }
-      if (*(size + 1) == '3') {
+      if (*(attr_size + 1) == '3') {
         W_L("<span style=\"font-size: xx-small\">");
         break;
       }
-      xhtml->font_size_flag--;
+      flg->font_size_flag = 0;
       break;
 
     case '+':
-      if (*(size + 1) == '1') {
+      if (*(attr_size + 1) == '1') {
         W_L("<span style=\"font-size: large\">");
         break;
       }
-      if (*(size + 1) == '2') {
+      if (*(attr_size + 1) == '2') {
         W_L("<span style=\"font-size: x-large\">");
         break;
       }
-      if (*(size + 1) == '3') {
+      if (*(attr_size + 1) == '3') {
         W_L("<span style=\"font-size: xx-large\">");
         break;
       }
-      xhtml->font_size_flag--;
+      flg->font_size_flag = 0;
       break;
 
     default:
-      WRN(doc->r, "invlalid font size. [%s] != (1|2|3|4|5|6|7|+1|+2|+3|-1|-2|-3)", size);
-      xhtml->font_size_flag--;
+      WRN(doc->r, "invlalid font size. [%s] != (1|2|3|4|5|6|7|+1|+2|+3|-1|-2|-3)", attr_size);
+      flg->font_size_flag = 0;
     }
   }
+  node->userData = flg;
+
   return xhtml->out;
 }
 
@@ -1290,18 +1482,20 @@ s_xhtml_1_0_start_font_tag(void *pdoc, Node *node)
  * @return The conversion result is returned.
  */
 static char *
-s_xhtml_1_0_end_font_tag(void *pdoc, Node *UNUSED(child)) 
+s_xhtml_1_0_end_font_tag(void *pdoc, Node *node)
 {
   xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc     *doc   = xhtml->doc;
 
-  if (xhtml->font_size_flag) {
+  xhtml_flags_t *flg = (xhtml_flags_t *)node->userData;
+  if (flg && flg->font_size_flag) {
     W_L("</span>");
-    xhtml->font_size_flag--;
   }
-  if (xhtml->font_color_flag) {
+  if (flg && flg->font_color_flag) {
     W_L("</font>");
-    xhtml->font_color_flag--;
+  }
+  if (IS_CSS_ON(xhtml->entryp)) {
+    chxj_css_pop_prop_list(xhtml->css_prop_stack);
   }
   return xhtml->out;
 }
@@ -1322,10 +1516,13 @@ s_xhtml_1_0_start_form_tag(void *pdoc, Node *node)
   Doc         *doc   = xhtml->doc;
   request_rec *r     = doc->r;
   Attr        *attr;
-  char        *new_hidden_tag = NULL;
   char        *attr_action = NULL;
   char        *attr_method = NULL;
-  char        *attr_name = NULL;
+  char        *attr_style  = NULL;
+  char        *attr_color  = NULL;
+  char        *attr_align  = NULL;
+  char        *attr_name   = NULL;
+  char        *new_hidden_tag = NULL;
 
   /*--------------------------------------------------------------------------*/
   /* Get Attributes                                                           */
@@ -1333,20 +1530,70 @@ s_xhtml_1_0_start_form_tag(void *pdoc, Node *node)
   for (attr = qs_get_attr(doc,node);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
-    char *name = qs_get_attr_name(doc,attr);
+    char *name  = qs_get_attr_name(doc,attr);
     char *value = qs_get_attr_value(doc,attr);
-    if (STRCASEEQ('a','A',"action",name)) {
-      attr_action = chxj_encoding_parameter(r, value);
-      attr_action = chxj_add_cookie_parameter(r, attr_action, xhtml->cookie);
-    }
-    else if (STRCASEEQ('m','M',"method",name)) {
-      attr_method = apr_pstrdup(doc->pool, value);
-    }
-    else if (STRCASEEQ('u','U',"utn",name)) {
-      /* ignore */
+    switch(*name) {
+    case 'a':
+    case 'A':
+      if (strcasecmp(name, "action") == 0) {
+        /*--------------------------------------------------------------------*/
+        /* CHTML 1.0                                                          */
+        /*--------------------------------------------------------------------*/
+        attr_action = value;
+      }
+      break;
+
+    case 'm':
+    case 'M':
+      if (strcasecmp(name, "method") == 0) {
+        /*--------------------------------------------------------------------*/
+        /* CHTML 1.0                                                          */
+        /*--------------------------------------------------------------------*/
+        attr_method = value;
+      }
+      break;
+
+    case 'n':
+    case 'N':
+      if (strcasecmp(name, "name") == 0) {
+        /*--------------------------------------------------------------------*/
+        /* CHTML 1.0                                                          */
+        /*--------------------------------------------------------------------*/
+        attr_name = value;
+      }
+      break;
+
+    case 's':
+    case 'S':
+      if (strcasecmp(name, "style") == 0) {
+        attr_style = value;
+      }
+      break;
+
+    default:
+      break;
     }
-    else if (STRCASEEQ('n','N',"name",name)) {
-      attr_name = apr_pstrdup(doc->pool, value);
+  }
+  if (IS_CSS_ON(xhtml->entryp)) {
+    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
+      css_property_t *color_prop      = chxj_css_get_property_value(doc, style, "color");
+      css_property_t *cur;
+      for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
+        if (STRCASEEQ('l','L',"left", cur->value)) {
+          attr_align = apr_pstrdup(doc->pool, "left");
+        }
+        else if (STRCASEEQ('c','C',"center",cur->value)) {
+          attr_align = apr_pstrdup(doc->pool, "center");
+        }
+        else if (STRCASEEQ('r','R',"right",cur->value)) {
+          attr_align = apr_pstrdup(doc->pool, "right");
+        }
+      }
+      for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
+        attr_color = apr_pstrdup(doc->pool, cur->value);
+      }
     }
   }
 
@@ -1354,17 +1601,23 @@ s_xhtml_1_0_start_form_tag(void *pdoc, Node *node)
 
   W_L("<form");
   if (attr_action) {
+    attr_action = chxj_encoding_parameter(r, attr_action, 1);
+    attr_action = chxj_add_cookie_parameter(r, attr_action, xhtml->cookie);
     char *q;
-    char *unused = NULL;
+    char *old_qs = NULL;
     q = strchr(attr_action, '?');
     if (q) {
-      new_hidden_tag = chxj_form_action_to_hidden_tag(r, doc->pool, attr_action, 1, post_flag, &unused, CHXJ_FALSE, CHXJ_FALSE);
-      if (new_hidden_tag) {
+      new_hidden_tag = chxj_form_action_to_hidden_tag(r, doc->pool, attr_action, 1, post_flag, &old_qs, CHXJ_FALSE, CHXJ_FALSE, xhtml->entryp);
+      if (new_hidden_tag || old_qs) {
         *q = 0;
       }
     }
     W_L(" action=\"");
     W_V(attr_action);
+    if (old_qs) {
+      W_L("?");
+      W_V(old_qs);
+    }
     W_L("\"");
   }
   if (attr_method) {
@@ -1378,6 +1631,23 @@ s_xhtml_1_0_start_form_tag(void *pdoc, Node *node)
     W_L("\"");
   }
   W_L(">");
+
+  xhtml_flags_t *flg = (xhtml_flags_t *)apr_palloc(doc->pool, sizeof(xhtml_flags_t));
+  memset(flg, 0, sizeof(*flg));
+  if (attr_color) {
+    attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
+    W_L("<font color=\"");
+    W_V(attr_color);
+    W_L("\">");
+    flg->with_font_flag = 1;
+  }
+  if (attr_align) {
+    W_L("<div align=\"");
+    W_V(attr_align);
+    W_L("\">");
+    flg->with_div_flag = 1;
+  }
+  node->userData = flg;
   if (new_hidden_tag) {
     W_V(new_hidden_tag);
   }
@@ -1394,12 +1664,22 @@ s_xhtml_1_0_start_form_tag(void *pdoc, Node *node)
  * @return The conversion result is returned.
  */
 static char *
-s_xhtml_1_0_end_form_tag(void *pdoc, Node *UNUSED(child)) 
+s_xhtml_1_0_end_form_tag(void *pdoc, Node *node)
 {
   xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc     *doc   = xhtml->doc;
 
+  xhtml_flags_t *flg = (xhtml_flags_t *)node->userData;
+  if (flg && flg->with_div_flag) {
+    W_L("</div>");
+  }
+  if (flg && flg->with_font_flag) {
+    W_L("</font>");
+  }
   W_L("</form>");
+  if (IS_CSS_ON(xhtml->entryp)) {
+    chxj_css_pop_prop_list(xhtml->css_prop_stack);
+  }
 
   return xhtml->out;
 }
@@ -1419,15 +1699,171 @@ s_xhtml_1_0_start_input_tag(void *pdoc, Node *node)
   xhtml_t     *xhtml       = GET_XHTML(pdoc);
   Doc         *doc         = xhtml->doc;
   request_rec *r           = doc->r;
-  char        *max_length  = NULL;
-  char        *type        = NULL;
-  char        *name        = NULL;
-  char        *value       = NULL;
-  char        *istyle      = NULL;
-  char        *size        = NULL;
-  char        *checked     = NULL;
-  char        *accesskey   = NULL;
+  Attr        *attr;
+  char        *attr_max_length  = NULL;
+  char        *attr_type        = NULL;
+  char        *attr_name        = NULL;
+  char        *attr_value       = NULL;
+  char        *attr_istyle      = NULL;
+  char        *attr_size        = NULL;
+  char        *attr_checked     = NULL;
+  char        *attr_accesskey   = NULL;
+  char        *attr_style       = NULL;
+
+  /*--------------------------------------------------------------------------*/
+  /* Get Attributes                                                           */
+  /*--------------------------------------------------------------------------*/
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) {
+    char *name  = qs_get_attr_name(doc,attr);
+    char *value = qs_get_attr_value(doc,attr);
+    if (STRCASEEQ('t','T',"type",name) && value && *value) {
+      char *tmp_type = qs_trim_string(doc->buf.pool, value);
+      if (tmp_type && (STRCASEEQ('t','T',"text",    tmp_type) ||
+                       STRCASEEQ('p','P',"password",tmp_type) ||
+                       STRCASEEQ('c','C',"checkbox",tmp_type) ||
+                       STRCASEEQ('r','R',"radio",   tmp_type) ||
+                       STRCASEEQ('h','H',"hidden",  tmp_type) ||
+                       STRCASEEQ('s','S',"submit",  tmp_type) ||
+                       STRCASEEQ('r','R',"reset",   tmp_type))) {
+        attr_type = tmp_type;
+      }
+    }
+    else if (STRCASEEQ('n','N',"name",name) && value && *value) {
+      attr_name = value;
+    }
+    else if (STRCASEEQ('v','V',"value",name) && value && *value) {
+      attr_value = value;
+    }
+    else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
+      attr_istyle = value;
+    }
+    else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
+      attr_max_length = value;
+    }
+    else if (STRCASEEQ('c','C',"checked", name)) {
+      attr_checked = value;
+    }
+    else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
+      attr_accesskey = value;
+    }
+    else if (STRCASEEQ('s','S',"size", name) && value && *value) {
+      attr_size = value;
+    }
+    else if (STRCASEEQ('s','S',"style", name) && value && *value) {
+      attr_style = value;
+    }
+  }
+
+  if (IS_CSS_ON(xhtml->entryp)) {
+    css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
+      css_property_t *cur;
+      for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
+        if (strcasestr(cur->value, "<ja:n>")) {
+          attr_istyle = "4";
+        }
+        else if (strcasestr(cur->value, "<ja:en>")) {
+          attr_istyle = "3";
+        }
+        else if (strcasestr(cur->value, "<ja:hk>")) {
+          attr_istyle = "2";
+        }
+        else if (strcasestr(cur->value, "<ja:h>")) {
+          attr_istyle = "1";
+        }
+      }
+    }
+  }
+  W_L("<input");
+  if (attr_type) {
+    attr_type = qs_trim_string(doc->buf.pool, attr_type);
+    if (attr_type && (STRCASEEQ('t','T',"text",    attr_type) ||
+                      STRCASEEQ('p','P',"password",attr_type) ||
+                      STRCASEEQ('c','C',"checkbox",attr_type) ||
+                      STRCASEEQ('r','R',"radio",   attr_type) ||
+                      STRCASEEQ('h','H',"hidden",  attr_type) ||
+                      STRCASEEQ('s','S',"submit",  attr_type) ||
+                      STRCASEEQ('r','R',"reset",   attr_type))) {
+      W_L(" type=\"");
+      W_V(attr_type);
+      W_L("\"");
+    }
+  }
+  if (attr_size && *attr_size) {
+    W_L(" size=\"");
+    W_V(attr_size);
+    W_L("\"");
+  }
+  if (attr_name && *attr_name) {
+    W_L(" name=\"");
+    W_V(attr_name);
+    W_L("\"");
+  }
+  if (attr_value && *attr_value) {
+    W_L(" value=\"");
+    W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
+    W_L("\"");
+  }
+  if (attr_accesskey && *attr_accesskey) {
+    W_L(" accesskey=\"");
+    W_V(attr_accesskey);
+    W_L("\"");
+  }
+  if (attr_istyle && *attr_istyle && (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4')) {
+    char *fmt = qs_conv_istyle_to_format(r->pool,attr_istyle);
+    if (attr_max_length && *attr_max_length) {
+      int ii;
+      for (ii=0; (unsigned int)ii<strlen(attr_max_length); ii++) {
+        if (attr_max_length[ii] < '0' || attr_max_length[ii] > '9') {
+          attr_max_length = apr_psprintf(r->pool, "0");
+          break;
+        }
+      }
 
+      if (strcmp(attr_max_length, "0")) {
+        char *vv = apr_psprintf(r->pool, " FORMAT=\"%d%s\"", atoi(attr_max_length), fmt);
+        W_V(vv);
+      }
+    }
+    else {
+      W_L(" FORMAT=\"");
+      W_L("*");
+      W_V(fmt);
+      W_L("\"");
+    }
+  }
+  else {
+    if (attr_max_length && *attr_max_length) {
+      if (chxj_chk_numeric(attr_max_length) != 0) {
+        attr_max_length = apr_psprintf(r->pool, "0");
+      }
+      if (strcmp(attr_max_length, "0")) {
+        char *vv = apr_psprintf(r->pool, " FORMAT=\"%dm\"", atoi(attr_max_length));
+        W_V(vv);
+      }
+    }
+  }
+  /*--------------------------------------------------------------------------*/
+  /* The figure is default for the password.                                  */
+  /*--------------------------------------------------------------------------*/
+  if (attr_type && (attr_istyle == NULL || *attr_istyle == 0) && STRCASEEQ('p','P',"password", attr_type) && ! xhtml->entryp->pc_flag) {
+    if (attr_max_length) {
+      W_L(" FORMAT=\"");
+      W_V(attr_max_length);
+      W_L("N\"");
+    }
+    else {
+      W_L(" FORMAT=\"*N\"");
+    }
+  }
+  if (attr_checked) {
+    W_L(" checked=\"checked\"");
+  }
+  W_L(" />");
+#if 0
   W_L("<input");
   /*--------------------------------------------------------------------------*/
   /* Get Attributes                                                           */
@@ -1466,6 +1902,11 @@ s_xhtml_1_0_start_input_tag(void *pdoc, Node *node)
     W_L("\"");
   }
   if (value && *value) {
+    if (type && (STRCASEEQ('s','S',"submit",type) || STRCASEEQ('r','R',"reset",type))) {
+      apr_size_t value_len = strlen(value);
+      value = chxj_conv_z2h(r, value, &value_len, xhtml->entryp);
+    }
+
     W_L(" value=\"");
     W_V(chxj_add_slash_to_doublequote(doc->pool, value));
     W_L("\"");
@@ -1476,7 +1917,7 @@ s_xhtml_1_0_start_input_tag(void *pdoc, Node *node)
     W_L("\"");
   }
   if (istyle && *istyle && (*istyle == '1' || *istyle == '2' || *istyle == '3' || *istyle == '4')) {
-    char *fmt = qs_conv_istyle_to_format(r,istyle);
+    char *fmt = qs_conv_istyle_to_format(r->pool,istyle);
     if (max_length && *max_length) {
       int ii;
       for (ii=0; (unsigned int)ii<strlen(max_length); ii++) {
@@ -1526,6 +1967,7 @@ s_xhtml_1_0_start_input_tag(void *pdoc, Node *node)
     W_L(" checked=\"checked\"");
   }
   W_L(" />");
+#endif
 
   return xhtml->out;
 }
@@ -1557,31 +1999,86 @@ s_xhtml_1_0_end_input_tag(void *pdoc, Node *UNUSED(child))
  * @return The conversion result is returned.
  */
 static char *
-s_xhtml_1_0_start_center_tag(void *pdoc, Node *UNUSED(node)) 
+s_xhtml_1_0_start_center_tag(void *pdoc, Node *node)
 {
-  xhtml_t *xhtml = GET_XHTML(pdoc);
-  Doc     *doc   = xhtml->doc;
-
-  W_L("<center>");
-  return xhtml->out;
-}
+  xhtml_t *xhtml;
+  Doc     *doc;
+  Attr    *attr;
+  char    *attr_style = NULL;
+  char    *attr_color = NULL;
+  char    *attr_size  = NULL;
 
+  xhtml = GET_XHTML(pdoc);
+  doc    = xhtml->doc;
 
-/**
- * It is a handler who processes the CENTER tag.
- *
- * @param pdoc  [i/o] The pointer to the XHTML structure at the output
- *                     destination is specified.
- * @param node   [i]   The CENTER tag node is specified.
- * @return The conversion result is returned.
- */
-static char *
-s_xhtml_1_0_end_center_tag(void *pdoc, Node *UNUSED(child)) 
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) {
+    char *name  = qs_get_attr_name(doc,attr);
+    char *value = qs_get_attr_value(doc,attr);
+    if (STRCASEEQ('s','S',"style",name) && value && *value) {
+      attr_style = value;
+    }
+  }
+  if (IS_CSS_ON(xhtml->entryp)) {
+    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *color_prop      = chxj_css_get_property_value(doc, style, "color");
+      css_property_t *size_prop       = chxj_css_get_property_value(doc, style, "font-size");
+      css_property_t *cur;
+      for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          attr_color = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+      for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          attr_size = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+    }
+  }
+
+  W_L("<center");
+  if (attr_size || attr_color) {
+    W_L(" style=\"");
+    if (attr_size) {
+      W_L("font-size:");
+      W_V(attr_size);
+      W_L(";");
+    }
+    if (attr_color) {
+      attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
+      W_L("color:");
+      W_V(attr_color);
+      W_L(";");
+    }
+    W_L("\"");
+  }
+  W_L(">");
+  
+  return xhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the CENTER tag.
+ *
+ * @param pdoc  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The CENTER tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_xhtml_1_0_end_center_tag(void *pdoc, Node *UNUSED(node))
 {
   xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc     *doc   = xhtml->doc;
 
   W_L("</center>");
+  if (IS_CSS_ON(xhtml->entryp)) {
+    chxj_css_pop_prop_list(xhtml->css_prop_stack);
+  }
   return xhtml->out;
 }
 
@@ -1597,63 +2094,162 @@ s_xhtml_1_0_end_center_tag(void *pdoc, Node *UNUSED(child))
 static char *
 s_xhtml_1_0_start_hr_tag(void *pdoc, Node *node)
 {
-  xhtml_t *xhtml = GET_XHTML(pdoc);
-  Doc     *doc   = xhtml->doc;
-  Attr    *attr;
+  Attr        *attr;
+  xhtml_t     *xhtml;
+  Doc         *doc;
+  request_rec *r;
+  char        *attr_align   = NULL;
+  char        *attr_size    = NULL;
+  char        *attr_width   = NULL;
+  char        *attr_noshade = NULL;
+  char        *attr_style   = NULL;
+  char        *attr_color   = NULL;
+
+  xhtml   = GET_XHTML(pdoc);
+  doc     = xhtml->doc;
+  r       = doc->r;
 
-  W_L("<hr");
   for (attr = qs_get_attr(doc,node);
        attr; 
        attr = qs_get_next_attr(doc,attr)) {
-    char *name = qs_get_attr_name(doc,attr);
+    char *name  = qs_get_attr_name (doc,attr);
     char *value = qs_get_attr_value(doc,attr);
-    if (STRCASEEQ('a','A',"align", name)) {
-      /*----------------------------------------------------------------------*/
-      /* CHTML 1.0                                                            */
-      /*----------------------------------------------------------------------*/
-      if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
-        W_L(" align=\"");
-        W_V(value);
-        W_L("\"");
+    switch(*name) {
+    case 'a':
+    case 'A':
+      if (strcasecmp(name, "align") == 0) {
+        /*--------------------------------------------------------------------*/
+        /* CHTML 1.0                                                          */
+        /*--------------------------------------------------------------------*/
+        if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
+          attr_align = value;
+        }
+      }
+      break;
+
+    case 's':
+    case 'S':
+      if (strcasecmp(name, "size") == 0) {
+        /*--------------------------------------------------------------------*/
+        /* CHTML 1.0                                                          */
+        /*--------------------------------------------------------------------*/
+        if (value && *value) {
+          attr_size = value;
+        }
+      }
+      else if (strcasecmp(name, "style") == 0) {
+        if (value && *value) {
+          attr_style = value;
+        }
+      }
+      break;
+
+    case 'w':
+    case 'W':
+      if (strcasecmp(name, "width") == 0) {
+        /*--------------------------------------------------------------------*/
+        /* CHTML 1.0                                                          */
+        /*--------------------------------------------------------------------*/
+        if (value && *value) {
+          attr_width = value;
+        }
+      }
+      break;
+
+    case 'n':
+    case 'N':
+      if (strcasecmp(name, "noshade") == 0) {
+        /*--------------------------------------------------------------------*/
+        /* CHTML 1.0                                                          */
+        /*--------------------------------------------------------------------*/
+        attr_noshade = apr_pstrdup(doc->pool, "noshade");
+      }
+      break;
+
+    case 'c':
+    case 'C':
+      if (strcasecmp(name, "color") == 0 && value && *value) {
+        /*--------------------------------------------------------------------*/
+        /* CHTML 4.0                                                          */
+        /*--------------------------------------------------------------------*/
+        attr_color = value;
       }
+      break;
+
+    default:
+      break;
     }
-    else if (STRCASEEQ('s','S',"size", name)) {
-      /*----------------------------------------------------------------------*/
-      /* CHTML 1.0                                                            */
-      /*----------------------------------------------------------------------*/
-      if (value && *value) {
-        W_L(" size=\"");
-        W_V(value);
-        W_L("\"");
+  }
+  if (IS_CSS_ON(xhtml->entryp)) {
+    css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
+      css_property_t *height_prop       = chxj_css_get_property_value(doc, style, "height");
+      css_property_t *width_prop        = chxj_css_get_property_value(doc, style, "width");
+      css_property_t *cur;
+      for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
+        if (STRCASEEQ('s','S',"solid",cur->value)) {
+          attr_noshade = "noshade";
+        }
+      }
+      for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
+        char *tmp = apr_pstrdup(doc->pool, cur->value);
+        char *tmpp = strstr(tmp, "px");
+        if (tmpp) { 
+          attr_size = apr_pstrdup(doc->pool, tmp);
+        }
+      }
+      for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
+        char *tmp = apr_pstrdup(doc->pool, cur->value);
+        char *tmpp = strstr(tmp, "px");
+        if (tmpp) {
+          attr_width = apr_pstrdup(doc->pool, tmp);
+        }
+        else {
+          tmpp = strstr(tmp, "%");
+          if (tmpp) {
+            attr_width = apr_pstrdup(doc->pool, tmp);
+          }
+        }
       }
     }
-    else if (STRCASEEQ('w','W',"width", name)) {
-      /*----------------------------------------------------------------------*/
-      /* CHTML 1.0                                                            */
-      /*----------------------------------------------------------------------*/
-      if (value && *value) {
-        W_L(" width=\"");
-        W_V(value);
-        W_L("\"");
+  }
+  W_L("<hr");
+  if (attr_align) {
+    W_L(" align=\"");
+    W_V(attr_align);
+    W_L("\"");
+  }
+  if (attr_size || attr_width || attr_noshade) {
+    W_L(" style=\"");
+    if (attr_size) {
+      W_L("height:");
+      W_V(attr_size);
+      if (!strstr(attr_size, "px")) {
+        W_L("px");
       }
+      W_L(";");
     }
-    else if (STRCASEEQ('n','N',"noshade", name)) {
-      /*----------------------------------------------------------------------*/
-      /* CHTML 1.0                                                            */
-      /*----------------------------------------------------------------------*/
-      /* ignore */
+    if (attr_width) {
+      W_L("width:");
+      W_V(attr_width);
+      if (!strstr(attr_width, "px") && !strstr(attr_width, "%")) {
+        W_L("px");
+      }
+      W_L(";");
     }
-    else if (STRCASEEQ('c','C',"color", name) && value && *value) {
-      /*----------------------------------------------------------------------*/
-      /* CHTML 4.0                                                            */
-      /*----------------------------------------------------------------------*/
-      W_L(" color=\"");
-      W_V(value);
-      W_L("\"");
+    if (attr_noshade) {
+      W_L("border-style:solid;");
     }
+    W_L("\"");
+  }
+  if (attr_color) {
+    W_L(" color=\"");
+    W_V(attr_color);
+    W_L("\"");
   }
   W_L(" />");
+
   return xhtml->out;
 }
 
@@ -1684,10 +2280,26 @@ s_xhtml_1_0_end_hr_tag(void *pdoc, Node *UNUSED(child))
  * @return The conversion result is returned.
  */
 static char *
-s_xhtml_1_0_start_pre_tag(void* pdoc, Node* UNUSED(node)) 
+s_xhtml_1_0_start_pre_tag(void *pdoc, Node *node)
 {
   xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc     *doc   = xhtml->doc;
+  Attr    *attr;
+  char    *attr_style = NULL;
+
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) {
+    char *nm  = qs_get_attr_name(doc,attr);
+    char *val = qs_get_attr_value(doc,attr);
+    if (val && STRCASEEQ('s','S',"style", nm)) {
+      attr_style = val;
+    }
+  }
+
+  if (IS_CSS_ON(xhtml->entryp)) {
+    s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+  }
 
   xhtml->pre_flag++;
   W_L("<pre>");
@@ -1711,6 +2323,9 @@ s_xhtml_1_0_end_pre_tag(void *pdoc, Node *UNUSED(child))
 
   W_L("</pre>");
   xhtml->pre_flag--;
+  if (IS_CSS_ON(xhtml->entryp)) {
+    chxj_css_pop_prop_list(xhtml->css_prop_stack);
+  }
 
   return xhtml->out;
 }
@@ -1730,9 +2345,11 @@ s_xhtml_1_0_start_p_tag(void *pdoc, Node *node)
   xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc     *doc   = xhtml->doc;
   Attr    *attr;
-  char    *align = NULL;
+  char    *attr_align = NULL;
+  char    *attr_style = NULL;
+  char    *attr_color = NULL;
+  char    *attr_blink = NULL;
 
-  W_L("<p");
   for (attr = qs_get_attr(doc,node);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
@@ -1743,14 +2360,63 @@ s_xhtml_1_0_start_p_tag(void *pdoc, Node *node)
       /* CHTML 1.0 (W3C version 3.2)                                          */
       /*----------------------------------------------------------------------*/
       if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
-        align = apr_pstrdup(doc->buf.pool, val);
+        attr_align = apr_pstrdup(doc->buf.pool, val);
         break;
       }
     }
+    else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
+      attr_style = apr_pstrdup(doc->buf.pool, val);
+    }
   }
-  if (align) {
-    W_L(" align=\"");
-    W_V(align);
+  if (IS_CSS_ON(xhtml->entryp)) {
+    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
+      css_property_t *color_prop      = chxj_css_get_property_value(doc, style, "color");
+      css_property_t *text_deco_prop  = chxj_css_get_property_value(doc, style, "text-decoration");
+      css_property_t *cur;
+      for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
+        if (STRCASEEQ('l','L',"left",cur->value)) {
+          attr_align = apr_pstrdup(doc->pool, "left");
+        }
+        else if (STRCASEEQ('c','C',"center",cur->value)) {
+          attr_align = apr_pstrdup(doc->pool, "center");
+        }
+        else if (STRCASEEQ('r','R',"right",cur->value)) {
+          attr_align = apr_pstrdup(doc->pool, "right");
+        }
+      }
+      for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          attr_color = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+      for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
+        if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
+          attr_blink = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+    }
+  }
+  W_L("<p");
+  if ((attr_align && *attr_align) || (attr_color && *attr_color) || (attr_blink && *attr_blink)) {
+    W_L(" style=\"");
+    if (attr_align) {
+      W_L("text-align:");
+      W_V(attr_align);
+      W_L(";");
+    }
+    if (attr_color) {
+      attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
+      W_L("color:");
+      W_V(attr_color);
+      W_L(";");
+    }
+    if (attr_blink) {
+      W_L("text-decoration:");
+      W_V(attr_blink);
+      W_L(";");
+    }
     W_L("\"");
   }
   W_L(">");
@@ -1773,6 +2439,9 @@ s_xhtml_1_0_end_p_tag(void *pdoc, Node *UNUSED(child))
   Doc     *doc   = xhtml->doc;
 
   W_L("</p>");
+  if (IS_CSS_ON(xhtml->entryp)) {
+    chxj_css_pop_prop_list(xhtml->css_prop_stack);
+  }
   return xhtml->out;
 }
 
@@ -1791,7 +2460,8 @@ s_xhtml_1_0_start_ul_tag(void *pdoc, Node *node)
   xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc     *doc   = xhtml->doc;
   Attr    *attr;
-  W_L("<ul");
+  char        *attr_type = NULL;
+  char        *attr_style = NULL;
   /*--------------------------------------------------------------------------*/
   /* Get Attributes                                                           */
   /*--------------------------------------------------------------------------*/
@@ -1802,12 +2472,39 @@ s_xhtml_1_0_start_ul_tag(void *pdoc, Node *node)
     char *value  = qs_get_attr_value(doc,attr);
     if (STRCASEEQ('t','T',"type",name)) {
       if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
-        W_L(" type=\"");
-        W_V(value);
-        W_L("\"");
+        attr_type = value;
+      }
+    }
+    else if (value && *value && STRCASEEQ('s','S',"style", name)) {
+      attr_style = value;
+    }
+  }
+  if (IS_CSS_ON(xhtml->entryp)) {
+    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
+      css_property_t *cur;
+      for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
+        if (STRCASEEQ('d','D',"disc",cur->value)) {
+          attr_type = apr_pstrdup(doc->pool, "disc");
+        }
+        else if (STRCASEEQ('c','C',"circle",cur->value)) {
+          attr_type = apr_pstrdup(doc->pool, "circle");
+        }
+        else if (STRCASEEQ('s','S',"square",cur->value)) {
+          attr_type = apr_pstrdup(doc->pool, "square");
+        }
       }
     }
   }
+  W_L("<ul");
+  if (attr_type) {
+    W_L(" style=\"");
+    W_L("list-style-type:");
+    W_V(attr_type);
+    W_L(";");
+    W_L("\"");
+  }
   W_L(">");
   return xhtml->out;
 }
@@ -1828,6 +2525,9 @@ s_xhtml_1_0_end_ul_tag(void *pdoc, Node *UNUSED(child))
   Doc     *doc   = xhtml->doc;
 
   W_L("</ul>");
+  if (IS_CSS_ON(xhtml->entryp)) {
+    chxj_css_pop_prop_list(xhtml->css_prop_stack);
+  }
   return xhtml->out;
 }
 
@@ -1846,37 +2546,51 @@ s_xhtml_1_0_start_h1_tag(void *pdoc, Node *node)
   xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc     *doc   = xhtml->doc;
   Attr    *attr;
+  char    *attr_style = NULL;
+  char    *attr_align = NULL;
 
-  W_L("<h1");
   for (attr = qs_get_attr(doc,node);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
-    char* name;
-    char* value;
-    name  = qs_get_attr_name(doc,attr);
-    value = qs_get_attr_value(doc,attr);
+    char *name  = qs_get_attr_name(doc,attr);
+    char *value = qs_get_attr_value(doc,attr);
     if (STRCASEEQ('a','A',"align", name)) {
-      if (value) {
-        if (STRCASEEQ('l','L',"left",value)) {
-          W_L(" style=\"");
-          W_L("text-align:left");
-          W_L("\"");
+      if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
+        attr_align = value;
+      }
+    }
+    else if (STRCASEEQ('s','S',"style",name) && value && *value) {
+      attr_style = value;
+    }
+  }
+  if (IS_CSS_ON(xhtml->entryp)) {
+    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
+      css_property_t *cur;
+      for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
+        if (STRCASEEQ('l','L',"left", cur->value)) {
+          attr_align = apr_pstrdup(doc->pool, "left");
         }
-        else if (STRCASEEQ('r','R',"right",value)) {
-          W_L(" style=\"");
-          W_L("text-align:right");
-          W_L("\"");
+        else if (STRCASEEQ('c','C',"center",cur->value)) {
+          attr_align = apr_pstrdup(doc->pool, "center");
         }
-        else if (STRCASEEQ('c','C',"center",value)) {
-          W_L(" style=\"");
-          W_L("text-align:center");
-          W_L("\"");
+        else if (STRCASEEQ('r','R',"right",cur->value)) {
+          attr_align = apr_pstrdup(doc->pool, "right");
         }
-        break;
       }
     }
   }
+  W_L("<h1");
+  if (attr_align) {
+    W_L(" style=\"");
+    W_L("text-align:");
+    W_V(attr_align);
+    W_L(";");
+    W_L("\"");
+  }
   W_L(">");
+
   return xhtml->out;
 }
 
@@ -1896,6 +2610,9 @@ s_xhtml_1_0_end_h1_tag(void *pdoc, Node *UNUSED(child))
   Doc     *doc   = xhtml->doc;
 
   W_L("</h1>");
+  if (IS_CSS_ON(xhtml->entryp)) {
+    chxj_css_pop_prop_list(xhtml->css_prop_stack);
+  }
   return xhtml->out;
 }
 
@@ -1914,37 +2631,51 @@ s_xhtml_1_0_start_h2_tag(void *pdoc, Node *node)
   xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc     *doc = xhtml->doc;
   Attr    *attr;
+  char    *attr_style = NULL;
+  char    *attr_align = NULL;
 
-  W_L("<h2");
   for (attr = qs_get_attr(doc,node);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
-    char* name;
-    char* value;
-    name  = qs_get_attr_name(doc,attr);
-    value = qs_get_attr_value(doc,attr);
+    char *name  = qs_get_attr_name(doc,attr);
+    char *value = qs_get_attr_value(doc,attr);
     if (STRCASEEQ('a','A',"align", name)) {
-      if (value) {
-        if (STRCASEEQ('l','L',"left",value)) {
-          W_L(" style=\"");
-          W_L("text-align:left");
-          W_L("\"");
+      if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
+        attr_align = value;
+      }
+    }
+    else if (STRCASEEQ('s','S',"style",name) && value && *value) {
+      attr_style = value;
+    }
+  }
+  if (IS_CSS_ON(xhtml->entryp)) {
+    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
+      css_property_t *cur;
+      for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
+        if (STRCASEEQ('l','L',"left", cur->value)) {
+          attr_align = apr_pstrdup(doc->pool, "left");
         }
-        else if (STRCASEEQ('r','R',"right",value)) {
-          W_L(" style=\"");
-          W_L("text-align:right");
-          W_L("\"");
+        else if (STRCASEEQ('c','C',"center",cur->value)) {
+          attr_align = apr_pstrdup(doc->pool, "center");
         }
-        else if (STRCASEEQ('c','C',"center",value)) {
-          W_L(" style=\"");
-          W_L("text-align:center");
-          W_L("\"");
+        else if (STRCASEEQ('r','R',"right",cur->value)) {
+          attr_align = apr_pstrdup(doc->pool, "right");
         }
-        break;
       }
     }
   }
+  W_L("<h2");
+  if (attr_align) {
+    W_L(" style=\"");
+    W_L("text-align:");
+    W_V(attr_align);
+    W_L(";");
+    W_L("\"");
+  }
   W_L(">");
+
   return xhtml->out;
 }
 
@@ -1964,6 +2695,9 @@ s_xhtml_1_0_end_h2_tag(void *pdoc, Node *UNUSED(child))
   Doc     *doc   = xhtml->doc;
 
   W_L("</h2>");
+  if (IS_CSS_ON(xhtml->entryp)) {
+    chxj_css_pop_prop_list(xhtml->css_prop_stack);
+  }
   return xhtml->out;
 }
 
@@ -1980,39 +2714,53 @@ static char *
 s_xhtml_1_0_start_h3_tag(void *pdoc, Node *node)
 {
   xhtml_t *xhtml = GET_XHTML(pdoc);
-  Doc     *doc   = xhtml->doc;
+  Doc     *doc = xhtml->doc;
   Attr    *attr;
+  char    *attr_style = NULL;
+  char    *attr_align = NULL;
 
-  W_L("<h3");
   for (attr = qs_get_attr(doc,node);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
-    char* name;
-    char* value;
-    name  = qs_get_attr_name(doc,attr);
-    value = qs_get_attr_value(doc,attr);
+    char *name  = qs_get_attr_name(doc,attr);
+    char *value = qs_get_attr_value(doc,attr);
     if (STRCASEEQ('a','A',"align", name)) {
-      if (value) {
-        if (STRCASEEQ('l','L',"left",value)) {
-          W_L(" style=\"");
-          W_L("text-align:left");
-          W_L("\"");
+      if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
+        attr_align = value;
+      }
+    }
+    else if (STRCASEEQ('s','S',"style",name) && value && *value) {
+      attr_style = value;
+    }
+  }
+  if (IS_CSS_ON(xhtml->entryp)) {
+    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
+      css_property_t *cur;
+      for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
+        if (STRCASEEQ('l','L',"left", cur->value)) {
+          attr_align = apr_pstrdup(doc->pool, "left");
         }
-        else if (STRCASEEQ('r','R',"right",value)) {
-          W_L(" style=\"");
-          W_L("text-align:right");
-          W_L("\"");
+        else if (STRCASEEQ('c','C',"center",cur->value)) {
+          attr_align = apr_pstrdup(doc->pool, "center");
         }
-        else if (STRCASEEQ('c','C',"center",value)) {
-          W_L(" style=\"");
-          W_L("text-align:center");
-          W_L("\"");
+        else if (STRCASEEQ('r','R',"right",cur->value)) {
+          attr_align = apr_pstrdup(doc->pool, "right");
         }
-        break;
       }
     }
   }
+  W_L("<h3");
+  if (attr_align) {
+    W_L(" style=\"");
+    W_L("text-align:");
+    W_V(attr_align);
+    W_L(";");
+    W_L("\"");
+  }
   W_L(">");
+
   return xhtml->out;
 }
 
@@ -2032,6 +2780,10 @@ s_xhtml_1_0_end_h3_tag(void *pdoc, Node *UNUSED(child))
   Doc     *doc   = xhtml->doc;
 
   W_L("</h3>");
+  if (IS_CSS_ON(xhtml->entryp)) {
+    chxj_css_pop_prop_list(xhtml->css_prop_stack);
+  }
+
   return xhtml->out;
 }
 
@@ -2048,39 +2800,53 @@ static char *
 s_xhtml_1_0_start_h4_tag(void *pdoc, Node *node)
 {
   xhtml_t *xhtml = GET_XHTML(pdoc);
-  Doc     *doc   = xhtml->doc;
+  Doc     *doc = xhtml->doc;
   Attr    *attr;
+  char    *attr_style = NULL;
+  char    *attr_align = NULL;
 
-  W_L("<h4");
   for (attr = qs_get_attr(doc,node);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
-    char* name;
-    char* value;
-    name  = qs_get_attr_name(doc,attr);
-    value = qs_get_attr_value(doc,attr);
+    char *name  = qs_get_attr_name(doc,attr);
+    char *value = qs_get_attr_value(doc,attr);
     if (STRCASEEQ('a','A',"align", name)) {
-      if (value) {
-        if (STRCASEEQ('l','L',"left",value)) {
-          W_L(" style=\"");
-          W_L("text-align:left");
-          W_L("\"");
+      if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
+        attr_align = value;
+      }
+    }
+    else if (STRCASEEQ('s','S',"style",name) && value && *value) {
+      attr_style = value;
+    }
+  }
+  if (IS_CSS_ON(xhtml->entryp)) {
+    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
+      css_property_t *cur;
+      for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
+        if (STRCASEEQ('l','L',"left", cur->value)) {
+          attr_align = apr_pstrdup(doc->pool, "left");
         }
-        else if (STRCASEEQ('r','R',"right",value)) {
-          W_L(" style=\"");
-          W_L("text-align:right");
-          W_L("\"");
+        else if (STRCASEEQ('c','C',"center",cur->value)) {
+          attr_align = apr_pstrdup(doc->pool, "center");
         }
-        else if (STRCASEEQ('c','C',"center",value)) {
-          W_L(" style=\"");
-          W_L("text-align:center");
-          W_L("\"");
+        else if (STRCASEEQ('r','R',"right",cur->value)) {
+          attr_align = apr_pstrdup(doc->pool, "right");
         }
-        break;
       }
     }
   }
+  W_L("<h4");
+  if (attr_align) {
+    W_L(" style=\"");
+    W_L("text-align:");
+    W_V(attr_align);
+    W_L(";");
+    W_L("\"");
+  }
   W_L(">");
+
   return xhtml->out;
 }
 
@@ -2100,6 +2866,10 @@ s_xhtml_1_0_end_h4_tag(void *pdoc, Node *UNUSED(child))
   Doc     *doc   = xhtml->doc;
 
   W_L("</h4>");
+  if (IS_CSS_ON(xhtml->entryp)) {
+    chxj_css_pop_prop_list(xhtml->css_prop_stack);
+  }
+
   return xhtml->out;
 }
 
@@ -2116,39 +2886,53 @@ static char *
 s_xhtml_1_0_start_h5_tag(void *pdoc, Node *node)
 {
   xhtml_t *xhtml = GET_XHTML(pdoc);
-  Doc     *doc   = xhtml->doc;
+  Doc     *doc = xhtml->doc;
   Attr    *attr;
+  char    *attr_style = NULL;
+  char    *attr_align = NULL;
 
-  W_L("<h5");
   for (attr = qs_get_attr(doc,node);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
-    char* name;
-    char* value;
-    name  = qs_get_attr_name(doc,attr);
-    value = qs_get_attr_value(doc,attr);
+    char *name  = qs_get_attr_name(doc,attr);
+    char *value = qs_get_attr_value(doc,attr);
     if (STRCASEEQ('a','A',"align", name)) {
-      if (value) {
-        if (STRCASEEQ('l','L',"left",value)) {
-          W_L(" style=\"");
-          W_L("text-align:left");
-          W_L("\"");
+      if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
+        attr_align = value;
+      }
+    }
+    else if (STRCASEEQ('s','S',"style",name) && value && *value) {
+      attr_style = value;
+    }
+  }
+  if (IS_CSS_ON(xhtml->entryp)) {
+    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
+      css_property_t *cur;
+      for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
+        if (STRCASEEQ('l','L',"left", cur->value)) {
+          attr_align = apr_pstrdup(doc->pool, "left");
         }
-        else if (STRCASEEQ('r','R',"right",value)) {
-          W_L(" style=\"");
-          W_L("text-align:right");
-          W_L("\"");
+        else if (STRCASEEQ('c','C',"center",cur->value)) {
+          attr_align = apr_pstrdup(doc->pool, "center");
         }
-        else if (STRCASEEQ('c','C',"center",value)) {
-          W_L(" style=\"");
-          W_L("text-align:center");
-          W_L("\"");
+        else if (STRCASEEQ('r','R',"right",cur->value)) {
+          attr_align = apr_pstrdup(doc->pool, "right");
         }
-        break;
       }
     }
   }
+  W_L("<h5");
+  if (attr_align) {
+    W_L(" style=\"");
+    W_L("text-align:");
+    W_V(attr_align);
+    W_L(";");
+    W_L("\"");
+  }
   W_L(">");
+
   return xhtml->out;
 }
 
@@ -2168,6 +2952,10 @@ s_xhtml_1_0_end_h5_tag(void *pdoc, Node *UNUSED(child))
   Doc     *doc   = xhtml->doc;
 
   W_L("</h5>");
+  if (IS_CSS_ON(xhtml->entryp)) {
+    chxj_css_pop_prop_list(xhtml->css_prop_stack);
+  }
+
   return xhtml->out;
 }
 
@@ -2184,40 +2972,54 @@ static char *
 s_xhtml_1_0_start_h6_tag(void *pdoc, Node *node)
 {
   xhtml_t *xhtml = GET_XHTML(pdoc);
-  Doc     *doc   = xhtml->doc;
+  Doc     *doc = xhtml->doc;
   Attr    *attr;
+  char    *attr_style = NULL;
+  char    *attr_align = NULL;
 
-  W_L("<h6");
   for (attr = qs_get_attr(doc,node);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
-    char* name;
-    char* value;
-    name  = qs_get_attr_name(doc,attr);
-    value = qs_get_attr_value(doc,attr);
+    char *name  = qs_get_attr_name(doc,attr);
+    char *value = qs_get_attr_value(doc,attr);
     if (STRCASEEQ('a','A',"align", name)) {
-      if (value) {
-        if (STRCASEEQ('l','L',"left",value)) {
-          W_L(" style=\"");
-          W_L("text-align:left");
-          W_L("\"");
+      if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
+        attr_align = value;
+      }
+    }
+    else if (STRCASEEQ('s','S',"style",name) && value && *value) {
+      attr_style = value;
+    }
+  }
+  if (IS_CSS_ON(xhtml->entryp)) {
+    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
+      css_property_t *cur;
+      for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
+        if (STRCASEEQ('l','L',"left", cur->value)) {
+          attr_align = apr_pstrdup(doc->pool, "left");
         }
-        else if (STRCASEEQ('r','R',"right",value)) {
-          W_L(" style=\"");
-          W_L("text-align:right");
-          W_L("\"");
+        else if (STRCASEEQ('c','C',"center",cur->value)) {
+          attr_align = apr_pstrdup(doc->pool, "center");
         }
-        else if (STRCASEEQ('c','C',"center",value)) {
-          W_L(" style=\"");
-          W_L("text-align:center");
-          W_L("\"");
+        else if (STRCASEEQ('r','R',"right",cur->value)) {
+          attr_align = apr_pstrdup(doc->pool, "right");
         }
-        break;
       }
     }
   }
-  W_L(">");
-  return xhtml->out;
+  W_L("<h6");
+  if (attr_align) {
+    W_L(" style=\"");
+    W_L("text-align:");
+    W_V(attr_align);
+    W_L(";");
+    W_L("\"");
+  }
+  W_L(">");
+
+  return xhtml->out;
 }
 
 
@@ -2236,6 +3038,10 @@ s_xhtml_1_0_end_h6_tag(void *pdoc, Node *UNUSED(child))
   Doc     *doc   = xhtml->doc;
 
   W_L("</h6>");
+  if (IS_CSS_ON(xhtml->entryp)) {
+    chxj_css_pop_prop_list(xhtml->css_prop_stack);
+  }
+
   return xhtml->out;
 }
 
@@ -2254,8 +3060,10 @@ s_xhtml_1_0_start_ol_tag(void *pdoc, Node *node)
   xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc     *doc   = xhtml->doc;
   Attr    *attr;
+  char    *attr_style = NULL;
+  char    *attr_start = NULL;
+  char    *attr_type  = NULL;
 
-  W_L("<ol");
   /*--------------------------------------------------------------------------*/
   /* Get Attributes                                                           */
   /*--------------------------------------------------------------------------*/
@@ -2264,18 +3072,57 @@ s_xhtml_1_0_start_ol_tag(void *pdoc, Node *node)
        attr = qs_get_next_attr(doc,attr)) {
     char *name = qs_get_attr_name(doc,attr);
     char *value = qs_get_attr_value(doc,attr);
-    if (STRCASEEQ('t','T',"type",name) && value && (*value == '1' || *value == 'a' || *value == 'A')) {
-      W_L(" type=\"");
-      W_V(value);
-      W_L("\"");
+    if (STRCASEEQ('t','T',"type",name) && value) {
+      if (*value == '1') {
+        attr_type = apr_pstrdup(doc->pool, "decimal");
+      }
+      else if (*value == 'a') {
+        attr_type = apr_pstrdup(doc->pool, "lower-alpha");
+      }
+      else if (*value == 'A') {
+        attr_type = apr_pstrdup(doc->pool, "upper-alpha");
+      }
     }
     else if (STRCASEEQ('s','S',"start",name) && value && *value) {
-      W_L(" start=\"");
-      W_V(value);
-      W_L("\"");
+      attr_start = value;
+    }
+    else if (STRCASEEQ('s','S',"style", name) && value && *value) {
+      attr_style = value;
+    }
+  }
+  if (IS_CSS_ON(xhtml->entryp)) {
+    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
+      css_property_t *cur;
+      for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
+        if (STRCASEEQ('d','D',"decimal", cur->value)) {
+          attr_type = apr_pstrdup(doc->pool, "decimal");
+        }
+        else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
+          attr_type = apr_pstrdup(doc->pool, "upper-alpha");
+        }
+        else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
+          attr_type = apr_pstrdup(doc->pool, "lower-alpha");
+        }
+      }
     }
   }
+  W_L("<ol");
+  if (attr_type) {
+    W_L(" style=\"");
+    W_L("list-style-type:");
+    W_V(attr_type);
+    W_L(";");
+    W_L("\"");
+  }
+  if (attr_start) {
+    W_L(" start=\"");
+    W_V(attr_start);
+    W_L("\"");
+  }
   W_L(">");
+
   return xhtml->out;
 }
 
@@ -2295,6 +3142,10 @@ s_xhtml_1_0_end_ol_tag(void *pdoc, Node *UNUSED(child))
   Doc     *doc   = xhtml->doc;
 
   W_L("</ol>");
+  if (IS_CSS_ON(xhtml->entryp)) {
+    chxj_css_pop_prop_list(xhtml->css_prop_stack);
+  }
+
   return xhtml->out;
 }
 
@@ -2313,29 +3164,80 @@ s_xhtml_1_0_start_li_tag(void *pdoc, Node *node)
   xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc     *doc   = xhtml->doc;
   Attr    *attr;
+  char    *attr_type  = NULL;
+  char    *attr_value = NULL;
+  char    *attr_style = NULL;
 
-  W_L("<li");
-  /*--------------------------------------------------------------------------*/
-  /* Get Attributes                                                           */
-  /*--------------------------------------------------------------------------*/
   for (attr = qs_get_attr(doc,node);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
     char *name  = qs_get_attr_name(doc,attr);
     char *value = qs_get_attr_value(doc,attr);
     if (STRCASEEQ('t','T',"type",name)) {
-      if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
-        W_L(" type=\"");
-        W_V(value);
-        W_L("\"");
+      if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
+        if (*value == '1') {
+          attr_type = apr_pstrdup(doc->pool, "decimal");
+        }
+        else if (*value == 'a') {
+          attr_type = apr_pstrdup(doc->pool, "lower-alpha");
+        }
+        else if (*value == 'A') {
+          attr_type = apr_pstrdup(doc->pool, "upper-alpha");
+        }
+        else {
+          attr_type = value;
+        }
       }
     }
     else if (STRCASEEQ('v','V',"value", name) && value && *value) {
-      W_L(" value=\"");
-      W_V(value);
-      W_L("\"");
+      attr_value = value;
+    }
+    else if (STRCASEEQ('s','S',"style", name) && value && *value) {
+      attr_style = value;
+    }
+  }
+  if (IS_CSS_ON(xhtml->entryp)) {
+    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
+      css_property_t *cur;
+      for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
+        if (STRCASEEQ('d','D',"decimal", cur->value)) {
+          attr_type = apr_pstrdup(doc->pool, "decimal");
+        }
+        else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
+          attr_type = apr_pstrdup(doc->pool, "upper-alpha");
+        }
+        else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
+          attr_type = apr_pstrdup(doc->pool, "lower-alpha");
+        }
+        else if (STRCASEEQ('d','D',"disc", cur->value)) {
+          attr_type = apr_pstrdup(doc->pool, "disc");
+        }
+        else if (STRCASEEQ('s','S',"square", cur->value)) {
+          attr_type = apr_pstrdup(doc->pool, "square");
+        }
+        else if (STRCASEEQ('c','C',"circle", cur->value)) {
+          attr_type = apr_pstrdup(doc->pool, "circle");
+        }
+      }
     }
   }
+
+
+  W_L("<li");
+  if (attr_type) {
+    W_L(" style=\"");
+    W_L("list-style-type:");
+    W_V(attr_type);
+    W_L(";");
+    W_L("\"");
+  }
+  if (attr_value) {
+    W_L(" value=\"");
+    W_V(attr_value);
+    W_L("\"");
+  }
   W_L(">");
   return xhtml->out;
 }
@@ -2356,6 +3258,9 @@ s_xhtml_1_0_end_li_tag(void *pdoc, Node *UNUSED(child))
   Doc     *doc   = xhtml->doc;
 
   W_L("</li>");
+  if (IS_CSS_ON(xhtml->entryp)) {
+    chxj_css_pop_prop_list(xhtml->css_prop_stack);
+  }
   return xhtml->out;
 }
 
@@ -2374,12 +3279,19 @@ s_xhtml_1_0_start_img_tag(void *pdoc, Node *node)
   Doc           *doc   = xhtml->doc;
   request_rec   *r     = doc->r;
   Attr          *attr;
+  char          *attr_src    = NULL;
+  char          *attr_alt    = NULL;
+  char          *attr_height = NULL;
+  char          *attr_width  = NULL;
+  char          *attr_align  = NULL;
+  char          *attr_style  = NULL;
+  char          *attr_hspace = NULL;
+  char          *attr_vspace = NULL;
 
 #ifndef IMG_NOT_CONVERT_FILENAME
   device_table  *spec = xhtml->spec;
 #endif
 
-  W_L("<img");
   /*--------------------------------------------------------------------------*/
   /* Get Attributes                                                           */
   /*--------------------------------------------------------------------------*/
@@ -2390,23 +3302,17 @@ s_xhtml_1_0_start_img_tag(void *pdoc, Node *node)
     char *value = qs_get_attr_value(doc,attr);
 
     if (STRCASEEQ('s','S',"src",name)) {
-      value = chxj_encoding_parameter(r, value);
+      value = chxj_encoding_parameter(r, value, 1);
       value = chxj_add_cookie_parameter(r, value, xhtml->cookie);
       value = chxj_add_cookie_no_update_parameter(r, value);
 #ifdef IMG_NOT_CONVERT_FILENAME
-
-      W_L(" src=\"");
-      W_V(value);
-      W_L("\"");
+      attr_src = value;
 
 #else
 
-      W_L(" src=\"");
       {
-        char *vv = chxj_img_conv(r,spec,value);
-        W_V(vv);
+        attr_src = chxj_img_conv(r,spec,value);
       }
-      W_L("\"");
 
 #endif
     }
@@ -2418,43 +3324,91 @@ s_xhtml_1_0_start_img_tag(void *pdoc, Node *node)
             STRCASEEQ('b','B',"bottom",value) ||
             STRCASEEQ('l','L',"left",  value) ||
             STRCASEEQ('r','R',"right", value)) {
-          W_L(" align=\"");
-          W_V(value);
-          W_L("\"");
+          attr_align = value;
         }
         else if (STRCASEEQ('c','C',"center",  value)) {
-          W_L(" align=\"");
-          W_L("middle");
-          W_L("\"");
+          attr_align = apr_pstrdup(doc->pool, "middle");
         }
       }
     }
     else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
-      W_L(" alt=\"");
-      W_V(value);
-      W_L("\"");
+      attr_alt = value;
     }
     else if (STRCASEEQ('w','W',"width",name) && value && *value) {
-      W_L(" width=\"");
-      W_V(value);
-      W_L("\"");
+      attr_width = value;
     }
     else if (STRCASEEQ('h','H',"height",name) && value && *value) {
-      W_L(" height=\"");
-      W_V(value);
-      W_L("\"");
+      attr_height = value;
     }
     else if (STRCASEEQ('h','H',"hspace",name) && value && *value) {
-      W_L(" hspace=\"");
-      W_V(value);
-      W_L("\"");
+      attr_hspace = value;
     }
     else if (STRCASEEQ('v','V',"vspace",name) && value && *value) {
-      W_L(" vspace=\"");
-      W_V(value);
-      W_L("\"");
+      attr_vspace = value;
+    }
+    else if (STRCASEEQ('s','S',"style",name) && value && *value) {
+      attr_style = value;
     }
   }
+
+  if (IS_CSS_ON(xhtml->entryp)) {
+    css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
+      css_property_t *width_prop  = chxj_css_get_property_value(doc, style, "width");
+      css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
+      css_property_t *cur;
+      for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
+        attr_height = apr_pstrdup(doc->pool, cur->value);
+      }
+      for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
+        attr_width = apr_pstrdup(doc->pool, cur->value);
+      }
+      for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
+        attr_align = apr_pstrdup(doc->pool, cur->value);
+      }
+    }
+  }
+
+  W_L("<img");
+  if (attr_src) {
+    W_L(" src=\"");
+    W_V(attr_src);
+    W_L("\"");
+  }
+  if (attr_align) {
+    W_L(" align=\"");
+    W_V(attr_align);
+    W_L("\"");
+  }
+  if (attr_width) {
+    W_L(" width=\"");
+    W_V(attr_width);
+    W_L("\"");
+  }
+  if (attr_height) {
+    W_L(" height=\"");
+    W_V(attr_height);
+    W_L("\"");
+  }
+  if (attr_hspace) {
+    W_L(" hspace=\"");
+    W_V(attr_hspace);
+    W_L("\"");
+  }
+  if (attr_vspace) {
+    W_L(" vspace=\"");
+    W_V(attr_vspace);
+    W_L("\"");
+  }
+  if (attr_alt) {
+    W_L(" alt=\"");
+    W_V(attr_alt);
+    W_L("\"");
+  }
+  else {
+    W_L(" alt=\"\"");
+  }
   W_L(" />");
   return xhtml->out;
 }
@@ -2486,7 +3440,7 @@ s_xhtml_1_0_end_img_tag(void *pdoc, Node *UNUSED(child))
  * @return The conversion result is returned.
  */
 static char *
-s_xhtml_1_0_start_select_tag(void *pdoc, Node *child)
+s_xhtml_1_0_start_select_tag(void *pdoc, Node *node)
 {
   xhtml_t *xhtml    = GET_XHTML(pdoc);
   Doc     *doc      = xhtml->doc;
@@ -2494,10 +3448,10 @@ s_xhtml_1_0_start_select_tag(void *pdoc, Node *child)
   char    *name     = NULL;
   char    *multiple = NULL;
   Attr    *attr;
-
+  char    *attr_style = NULL;
 
   W_L("<select");
-  for (attr = qs_get_attr(doc,child);
+  for (attr = qs_get_attr(doc,node);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
     char *nm  = qs_get_attr_name(doc,attr);
@@ -2508,6 +3462,12 @@ s_xhtml_1_0_start_select_tag(void *pdoc, Node *child)
       /*----------------------------------------------------------------------*/
       size = apr_pstrdup(doc->buf.pool, val);
     }
+    else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0 version 2.0                                                */
+      /*----------------------------------------------------------------------*/
+      attr_style = apr_pstrdup(doc->buf.pool, val);
+    }
     else if (STRCASEEQ('n','N',"name",nm)) {
       /*----------------------------------------------------------------------*/
       /* CHTML 1.0 version 2.0                                                */
@@ -2536,6 +3496,10 @@ s_xhtml_1_0_start_select_tag(void *pdoc, Node *child)
     W_L(" multiple=\"true\"");
   }
   W_L(">");
+  if (IS_CSS_ON(xhtml->entryp)) {
+    s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+  }
+
   return xhtml->out;
 }
 
@@ -2555,6 +3519,9 @@ s_xhtml_1_0_end_select_tag(void *pdoc, Node *UNUSED(child))
   Doc     *doc   = xhtml->doc;
 
   W_L("</select>");
+  if (IS_CSS_ON(xhtml->entryp)) {
+    chxj_css_pop_prop_list(xhtml->css_prop_stack);
+  }
   return xhtml->out;
 }
 
@@ -2568,17 +3535,18 @@ s_xhtml_1_0_end_select_tag(void *pdoc, Node *UNUSED(child))
  * @return The conversion result is returned.
  */
 static char *
-s_xhtml_1_0_start_option_tag(void *pdoc, Node *child)
+s_xhtml_1_0_start_option_tag(void *pdoc, Node *node)
 {
   xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc     *doc   = xhtml->doc;
   Attr    *attr;
+  char    *attr_style = NULL;
 
   char *selected   = NULL;
   char *value      = NULL;
 
   W_L("<option");
-  for (attr = qs_get_attr(doc,child);
+  for (attr = qs_get_attr(doc,node);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
     char *nm  = qs_get_attr_name(doc,attr);
@@ -2587,6 +3555,10 @@ s_xhtml_1_0_start_option_tag(void *pdoc, Node *child)
       /* CHTML version 2.0 */
       selected = apr_pstrdup(doc->buf.pool, val);
     }
+    else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
+      /* CHTML version 2.0 */
+      attr_style = apr_pstrdup(doc->buf.pool, val);
+    }
     else if (STRCASEEQ('v','V',"value",nm)) {
       /* CHTML version 2.0 */
       value = apr_pstrdup(doc->buf.pool, val);
@@ -2601,6 +3573,9 @@ s_xhtml_1_0_start_option_tag(void *pdoc, Node *child)
     W_L(" selected=\"selected\"");
   }
   W_L(">");
+  if (IS_CSS_ON(xhtml->entryp)) {
+    s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+  }
   return xhtml->out;
 }
 
@@ -2620,6 +3595,10 @@ s_xhtml_1_0_end_option_tag(void *pdoc, Node *UNUSED(child))
   Doc     *doc   = xhtml->doc;
 
   W_L("</option>");
+  if (IS_CSS_ON(xhtml->entryp)) {
+    chxj_css_pop_prop_list(xhtml->css_prop_stack);
+  }
+
   return xhtml->out;
 }
 
@@ -2633,31 +3612,169 @@ s_xhtml_1_0_end_option_tag(void *pdoc, Node *UNUSED(child))
  * @return The conversion result is returned.
  */
 static char *
-s_xhtml_1_0_start_div_tag(void *pdoc, Node *child)
+s_xhtml_1_0_start_div_tag(void *pdoc, Node *node)
 {
-  xhtml_t *xhtml = GET_XHTML(pdoc);
-  Doc     *doc   = xhtml->doc;
-  Attr    *attr;
-  char    *align   = NULL;
+  xhtml_t     *xhtml = GET_XHTML(pdoc);
+  Doc         *doc   = xhtml->doc;
+  Attr        *attr;
+  char        *attr_style             = NULL;
+  char        *attr_align             = NULL;
+  char        *attr_display           = NULL;
+  char        *attr_decoration        = NULL;
+  char        *attr_wap_marquee_style = NULL;
+  char        *attr_wap_marquee_dir   = NULL;
+  char        *attr_wap_marquee_loop  = NULL;
+  char        *attr_color             = NULL;
+  char        *attr_bgcolor           = NULL;
+  char        *attr_font_size         = NULL;
 
-  W_L("<div");
-  for (attr = qs_get_attr(doc,child);
+  for (attr = qs_get_attr(doc,node);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
     char *nm  = qs_get_attr_name(doc,attr);
     char *val = qs_get_attr_value(doc,attr);
     if (STRCASEEQ('a','A',"align",nm)) {
-      /*=====================================================================*/
-      /* CHTML version 3.2                                                   */
-      /*=====================================================================*/
+      /*----------------------------------------------------------------------*/
+      /* CHTML 1.0 (W3C version 3.2)                                          */
+      /*----------------------------------------------------------------------*/
       if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
-        align = apr_pstrdup(doc->buf.pool, val);
+        attr_align = apr_pstrdup(doc->buf.pool, val);
       }
     }
+    else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
+      attr_style = apr_pstrdup(doc->buf.pool, val);
+    }
   }
-  if (align) {
-    W_L(" align=\"");
-    W_V(align);
+
+  if (IS_CSS_ON(xhtml->entryp)) {
+    css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *display_prop           = chxj_css_get_property_value(doc, style, "display");
+      css_property_t *text_decoration_prop   = chxj_css_get_property_value(doc, style, "text-decoration");
+      css_property_t *color_prop             = chxj_css_get_property_value(doc, style, "color");
+      css_property_t *text_align_prop        = chxj_css_get_property_value(doc, style, "text-align");
+      css_property_t *font_size_prop         = chxj_css_get_property_value(doc, style, "font-size");
+      css_property_t *background_color_prop  = chxj_css_get_property_value(doc, style, "background-color");
+      css_property_t *background_prop        = chxj_css_get_property_value(doc, style, "background");
+
+      css_property_t *cur;
+      for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
+        if (strcasecmp("-wap-marquee", cur->value) == 0) {
+          attr_display = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+      for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
+        if (STRCASEEQ('b','B',"blink", cur->value)) {
+          attr_decoration = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+      for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
+        attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
+        attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
+      }
+      for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
+        char *ss = strchr(cur->value, '#');
+        if (ss) {
+          attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
+          attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
+        }
+      }
+      for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
+        attr_color = apr_pstrdup(doc->pool, cur->value);
+      }
+      for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
+        attr_align = apr_pstrdup(doc->pool, cur->value);
+      }
+      for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
+        if (   STRCASEEQ('x','X',"xx-small",cur->value)
+            || STRCASEEQ('x','X',"x-small",cur->value)
+            || STRCASEEQ('s','S',"small",cur->value)
+            || STRCASEEQ('m','M',"medium",cur->value)
+            || STRCASEEQ('l','L',"large",cur->value)
+            || STRCASEEQ('x','X',"x-large",cur->value)
+            || STRCASEEQ('x','X',"xx-large",cur->value)) {
+          attr_font_size = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+      if (attr_display) {
+        css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
+        css_property_t *wap_marquee_dir_prop   = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
+        css_property_t *wap_marquee_loop_prop  = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
+        for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
+          if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
+            attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
+          }
+        }
+        for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
+          if (STRCASEEQ('l','L',"ltr",cur->value)) {
+            attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('r','R',"rtl",cur->value)) {
+            attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
+          }
+        }
+        for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
+          attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+    }
+  }  
+  W_L("<div");
+  if (attr_align
+      || attr_display
+      || attr_decoration
+      || attr_wap_marquee_style
+      || attr_wap_marquee_dir
+      || attr_wap_marquee_loop
+      || attr_color
+      || attr_bgcolor
+      || attr_font_size) {
+    W_L(" style=\"");
+    if (attr_align) {
+      W_L("text-align:");
+      W_V(attr_align);
+      W_L(";");
+    }
+    if (attr_display) {
+      W_L("display:");
+      W_V(attr_display);
+      W_L(";");
+    }
+    if (attr_decoration) {
+      W_L("text-decoration:");
+      W_V(attr_decoration);
+      W_L(";");
+    }
+    if (attr_wap_marquee_style) {
+      W_L("-wap-marquee-style:");
+      W_V(attr_wap_marquee_style);
+      W_L(";");
+    }
+    if (attr_wap_marquee_dir) {
+      W_L("-wap-marquee-dir:");
+      W_V(attr_wap_marquee_dir);
+      W_L(";");
+    }
+    if (attr_wap_marquee_loop) {
+      W_L("-wap-marquee-loop:");
+      W_V(attr_wap_marquee_loop);
+      W_L(";");
+    }
+    if (attr_color) {
+      W_L("color:");
+      W_V(attr_color);
+      W_L(";");
+    }
+    if (attr_bgcolor) {
+      W_L("background-color:");
+      W_V(attr_bgcolor);
+      W_L(";");
+    }
+    if (attr_font_size) {
+      W_L("font-size:");
+      W_V(attr_font_size);
+      W_L(";");
+    }
     W_L("\"");
   }
   W_L(">");
@@ -2679,6 +3796,9 @@ s_xhtml_1_0_end_div_tag(void *pdoc, Node *UNUSED(child))
   xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc     *doc   = xhtml->doc;
   W_L("</div>");
+  if (IS_CSS_ON(xhtml->entryp)) {
+    chxj_css_pop_prop_list(xhtml->css_prop_stack);
+  }
   return xhtml->out;
 }
 
@@ -2760,41 +3880,92 @@ s_xhtml_1_0_start_textarea_tag(void *pdoc, Node *node)
   xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc     *doc   = xhtml->doc;
   Attr    *attr;
+  char    *attr_accesskey = NULL;
+  char    *attr_name      = NULL;
+  char    *attr_rows      = NULL;
+  char    *attr_cols      = NULL;
+  char    *attr_istyle    = NULL;
+  char    *attr_style     = NULL;
 
   xhtml->textarea_flag++;
-  W_L("<textarea");
   for (attr = qs_get_attr(doc,node);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
     char *name  = qs_get_attr_name(doc,attr);
     char *value = qs_get_attr_value(doc,attr);
     if (STRCASEEQ('n','N',"name",name) && value && *value) {
-      W_L(" name=\"");
-      W_V(value);
-      W_L("\"");
+      attr_name = value;
     }
     else if (STRCASEEQ('r','R',"rows",name) && value && *value) {
-      W_L(" rows=\"");
-      W_V(value);
-      W_L("\"");
+      attr_rows = value;
     }
     else if (STRCASEEQ('c','C',"cols",name) && value && *value) {
-      W_L(" cols=\"");
-      W_V(value);
-      W_L("\"");
+      attr_cols = value;
     }
     else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
-      char *fmt = qs_conv_istyle_to_format(doc->r,value);
+      attr_istyle = value;
+#if 0
+      char *fmt = qs_conv_istyle_to_format(doc->r->pool,value);
       W_L(" FORMAT=\"*");
       W_V(fmt);
       W_L("\"");
+#endif
     }
     else if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
-      W_L(" accesskey=\"");
-      W_V(value);
-      W_L("\"");
+      attr_accesskey = value;
+    }
+    else if (STRCASEEQ('s','S',"style",name) && value && *value != 0) {
+      attr_style = value;
+    }
+  }
+  if (IS_CSS_ON(xhtml->entryp)) {
+    css_prop_list_t *style = s_xhtml_1_0_nopush_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
+      css_property_t *cur;
+      for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
+        if (strcasestr(cur->value, "<ja:n>")) {
+          attr_istyle = "4";
+        }
+        else if (strcasestr(cur->value, "<ja:en>")) {
+          attr_istyle = "3";
+        }
+        else if (strcasestr(cur->value, "<ja:hk>")) {
+          attr_istyle = "2";
+        }
+        else if (strcasestr(cur->value, "<ja:h>")) {
+          attr_istyle = "1";
+        }
+      }
     }
   }
+  W_L("<textarea");
+  if (attr_accesskey) {
+    W_L(" accesskey=\"");
+    W_V(attr_accesskey);
+    W_L("\"");
+  }
+  if (attr_name) {
+    W_L(" name=\"");
+    W_V(attr_name);
+    W_L("\"");
+  }
+  if (attr_rows) {
+    W_L(" rows=\"");
+    W_V(attr_rows);
+    W_L("\"");
+  }
+  if (attr_cols) {
+    W_L(" cols=\"");
+    W_V(attr_cols);
+    W_L("\"");
+  }
+  if (attr_istyle) {
+    char *fmt = qs_conv_istyle_to_format(doc->r->pool, attr_istyle);
+    W_L(" FORMAT=\"*");
+    W_V(fmt);
+    W_L("\"");
+  }
   W_L(">");
   return xhtml->out;
 }
@@ -2832,6 +4003,7 @@ s_xhtml_1_0_text_tag(void *pdoc, Node *child)
   char        one_byte[2];
   int         ii;
   int         tdst_len;
+  apr_size_t  z2h_input_len;
   
   textval = qs_get_node_value(doc,child);
   if (strlen(textval) == 0) {
@@ -2874,6 +4046,9 @@ s_xhtml_1_0_text_tag(void *pdoc, Node *child)
       tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
     }
   }
+  z2h_input_len = strlen(tdst);
+  tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, xhtml->entryp);
+
   W_V(tdst);
   return xhtml->out;
 }
@@ -2888,11 +4063,81 @@ s_xhtml_1_0_text_tag(void *pdoc, Node *child)
  * @return The conversion result is returned.
  */
 static char *
-s_xhtml_1_0_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
+s_xhtml_1_0_start_blockquote_tag(void *pdoc, Node *node)
 {
-  xhtml_t *xhtml = GET_XHTML(pdoc);
-  Doc     *doc   = xhtml->doc;
-  W_L("<blockquote>");
+  xhtml_t *xhtml;
+  Doc      *doc;
+  Attr     *attr;
+  char     *attr_style = NULL;
+  char     *attr_color = NULL;
+  char     *attr_size  = NULL;
+
+  xhtml  = GET_XHTML(pdoc);
+  doc     = xhtml->doc;
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) {
+    char *nm  = qs_get_attr_name(doc,attr);
+    char *val = qs_get_attr_value(doc,attr);
+    if (val && STRCASEEQ('s','S',"style", nm)) {
+      attr_style = val;
+    }
+  }
+  if (IS_CSS_ON(xhtml->entryp)) {
+    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
+      css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
+      css_property_t *cur;
+      for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          attr_color = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+      for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          if (STRCASEEQ('x','X',"xx-small",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('x','X',"x-small",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('s','S',"small",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('m','M',"medium",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('l','L',"large",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('x','X',"x-large",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+        }
+      }
+    }
+  }
+  W_L("<blockquote");
+  if (attr_color || attr_size) {
+    W_L(" style=\"");
+    if (attr_color) {
+      attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
+      W_L("color:");
+      W_V(attr_color);
+      W_L(";");
+    }
+    if (attr_size) {
+      W_L("font-size:");
+      W_V(attr_size);
+      W_L(";");
+    }
+    W_L("\"");
+  }
+  W_L(">");
   return xhtml->out;
 }
 
@@ -2911,6 +4156,9 @@ s_xhtml_1_0_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
   xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc     *doc   = xhtml->doc;
   W_L("</blockquote>");
+  if (IS_CSS_ON(xhtml->entryp)) {
+    chxj_css_pop_prop_list(xhtml->css_prop_stack);
+  }
   return xhtml->out;
 }
 
@@ -2926,10 +4174,13 @@ s_xhtml_1_0_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
 static char *
 s_xhtml_1_0_start_dir_tag(void *pdoc, Node *node)
 {
-  xhtml_t *xhtml = GET_XHTML(pdoc);
-  Doc     *doc = xhtml->doc;
+  xhtml_t *xhtml      = GET_XHTML(pdoc);
+  Doc       *doc        = xhtml->doc;
   Attr      *attr;
-  W_L("<dir");
+  char      *attr_style = NULL;
+  char      *attr_color = NULL;
+  char      *attr_type  = NULL;
+  char      *attr_size  = NULL;
   for (attr = qs_get_attr(doc,node);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
@@ -2937,12 +4188,78 @@ s_xhtml_1_0_start_dir_tag(void *pdoc, Node *node)
     char *value  = qs_get_attr_value(doc,attr);
     if (STRCASEEQ('t','T',"type",name)) {
       if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
-        W_L(" type=\"");
-        W_V(value);
-        W_L("\"");
+        attr_type = value;
+      }
+    }
+    else if (STRCASEEQ('s','S',"style", name) && value && *value) {
+      attr_style = value;
+    }
+  }
+  if (IS_CSS_ON(xhtml->entryp)) {
+    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *color_prop           = chxj_css_get_property_value(doc, style, "color");
+      css_property_t *size_prop            = chxj_css_get_property_value(doc, style, "font-size");
+      css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
+      css_property_t *cur;
+      for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          attr_color = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+      for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          attr_type = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+      for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          if (STRCASEEQ('x','X',"xx-small",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('x','X',"x-small",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('s','S',"small",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('m','M',"medium",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('l','L',"large",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('x','X',"x-large",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+        }
       }
     }
   }
+  W_L("<dir");
+  if (attr_type || attr_color || attr_size) {
+    W_L(" style=\"");
+    if (attr_type) {
+      W_L("list-style-type:");
+      W_V(attr_type);
+      W_L(";");
+    }
+    if (attr_color) {
+      attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
+      W_L("color:");
+      W_V(attr_color);
+      W_L(";");
+    }
+    if (attr_size) {
+      W_L("font-size:");
+      W_V(attr_size);
+      W_L(";");
+    }
+    W_L("\"");
+  }
   W_L(">");
   return xhtml->out;
 }
@@ -2962,6 +4279,9 @@ s_xhtml_1_0_end_dir_tag(void *pdoc, Node *UNUSED(child))
   xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc     *doc = xhtml->doc;
   W_L("</dir>");
+  if (IS_CSS_ON(xhtml->entryp)) {
+    chxj_css_pop_prop_list(xhtml->css_prop_stack);
+  }
   return xhtml->out;
 }
 
@@ -2975,29 +4295,100 @@ s_xhtml_1_0_end_dir_tag(void *pdoc, Node *UNUSED(child))
  * @return The conversion result is returned.
  */
 static char *
-s_xhtml_1_0_start_dl_tag(void *pdoc, Node *UNUSED(child))
+s_xhtml_1_0_start_dl_tag(void *pdoc, Node *node)
 {
-  xhtml_t *xhtml = GET_XHTML(pdoc);
-  Doc *doc = xhtml->doc;
-  W_L("<dl>");
-  return xhtml->out;
-}
-
+  xhtml_t *xhtml      = GET_XHTML(pdoc);
+  Doc     *doc        = xhtml->doc;
+  Attr    *attr;
+  char    *attr_style = NULL;
+  char    *attr_color = NULL;
+  char    *attr_size  = NULL;
 
-/**
- * It is a handler who processes the DL tag.
- *
- * @param pdoc  [i/o] The pointer to the XHTML structure at the output
- *                     destination is specified.
- * @param node   [i]   The DL tag node is specified.
- * @return The conversion result is returned.
- */
-static char *
-s_xhtml_1_0_end_dl_tag(void *pdoc, Node *UNUSED(child))
-{
-  xhtml_t *xhtml = GET_XHTML(pdoc);
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) {
+    char *name   = qs_get_attr_name(doc,attr);
+    char *value  = qs_get_attr_value(doc,attr);
+    if (STRCASEEQ('s','S',"style", name) && value && *value) {
+      attr_style = value;
+    }
+  }
+  if (IS_CSS_ON(xhtml->entryp)) {
+    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *color_prop           = chxj_css_get_property_value(doc, style, "color");
+      css_property_t *size_prop            = chxj_css_get_property_value(doc, style, "font-size");
+      css_property_t *cur;
+      for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          attr_color = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+      for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          if (STRCASEEQ('x','X',"xx-small",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('x','X',"x-small",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('s','S',"small",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('m','M',"medium",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('l','L',"large",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('x','X',"x-large",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+        }
+      }
+    }
+  }
+  W_L("<dl");
+  if (attr_color || attr_size) {
+    W_L(" style=\"");
+    if (attr_color) {
+      attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
+      W_L("color:");
+      W_V(attr_color);
+      W_L(";");
+    }
+    if (attr_size) {
+      W_L("font-size:");
+      W_V(attr_size);
+      W_L(";");
+    }
+    W_L("\"");
+  }
+  W_L(">");
+  return xhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the DL tag.
+ *
+ * @param pdoc  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The DL tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_xhtml_1_0_end_dl_tag(void *pdoc, Node *UNUSED(child))
+{
+  xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc *doc = xhtml->doc;
   W_L("</dl>");
+  if (IS_CSS_ON(xhtml->entryp)) {
+    chxj_css_pop_prop_list(xhtml->css_prop_stack);
+  }
   return xhtml->out;
 }
 
@@ -3011,11 +4402,79 @@ s_xhtml_1_0_end_dl_tag(void *pdoc, Node *UNUSED(child))
  * @return The conversion result is returned.
  */
 static char *
-s_xhtml_1_0_start_dt_tag(void *pdoc, Node *UNUSED(child))
+s_xhtml_1_0_start_dt_tag(void *pdoc, Node *node)
 {
-  xhtml_t *xhtml = GET_XHTML(pdoc);
-  Doc     *doc   = xhtml->doc;
-  W_L("<dt>");
+  xhtml_t *xhtml      = GET_XHTML(pdoc);
+  Doc     *doc        = xhtml->doc;
+  Attr    *attr;
+  char    *attr_style = NULL;
+  char    *attr_color = NULL;
+  char    *attr_size  = NULL;
+
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) {
+    char *name   = qs_get_attr_name(doc,attr);
+    char *value  = qs_get_attr_value(doc,attr);
+    if (STRCASEEQ('s','S',"style", name) && value && *value) {
+      attr_style = value;
+    }
+  }
+  if (IS_CSS_ON(xhtml->entryp)) {
+    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *color_prop           = chxj_css_get_property_value(doc, style, "color");
+      css_property_t *size_prop            = chxj_css_get_property_value(doc, style, "font-size");
+      css_property_t *cur;
+      for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          attr_color = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+      for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          if (STRCASEEQ('x','X',"xx-small",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('x','X',"x-small",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('s','S',"small",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('m','M',"medium",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('l','L',"large",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('x','X',"x-large",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+        }
+      }
+    }
+  }
+  W_L("<dt");
+  if (attr_color || attr_size) {
+    W_L(" style=\"");
+    if (attr_color) {
+      attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
+      W_L("color:");
+      W_V(attr_color);
+      W_L(";");
+    }
+    if (attr_size) {
+      W_L("font-size:");
+      W_V(attr_size);
+      W_L(";");
+    }
+    W_L("\"");
+  }
+  W_L(">");
   return xhtml->out;
 }
 
@@ -3034,6 +4493,9 @@ s_xhtml_1_0_end_dt_tag(void *pdoc, Node *UNUSED(child))
   xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc     *doc   = xhtml->doc;
   W_L("</dt>");
+  if (IS_CSS_ON(xhtml->entryp)) {
+    chxj_css_pop_prop_list(xhtml->css_prop_stack);
+  }
   return xhtml->out;
 }
 
@@ -3047,17 +4509,85 @@ s_xhtml_1_0_end_dt_tag(void *pdoc, Node *UNUSED(child))
  * @return The conversion result is returned.
  */
 static char *
-s_xhtml_1_0_start_dd_tag(void *pdoc, Node *UNUSED(child))
+s_xhtml_1_0_start_dd_tag(void *pdoc, Node *node)
 {
-  xhtml_t *xhtml = GET_XHTML(pdoc);
-  Doc     *doc   = xhtml->doc;
-  W_L("<dd>");
+  xhtml_t *xhtml      = GET_XHTML(pdoc);
+  Doc     *doc        = xhtml->doc;
+  Attr    *attr;
+  char    *attr_style = NULL;
+  char    *attr_color = NULL;
+  char    *attr_size  = NULL;
+
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) {
+    char *name   = qs_get_attr_name(doc,attr);
+    char *value  = qs_get_attr_value(doc,attr);
+    if (STRCASEEQ('s','S',"style", name) && value && *value) {
+      attr_style = value;
+    }
+  }
+  if (IS_CSS_ON(xhtml->entryp)) {
+    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *color_prop           = chxj_css_get_property_value(doc, style, "color");
+      css_property_t *size_prop            = chxj_css_get_property_value(doc, style, "font-size");
+      css_property_t *cur;
+      for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          attr_color = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+      for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          if (STRCASEEQ('x','X',"xx-small",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('x','X',"x-small",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('s','S',"small",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('m','M',"medium",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('l','L',"large",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('x','X',"x-large",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+        }
+      }
+    }
+  }
+  W_L("<dd");
+  if (attr_color || attr_size) {
+    W_L(" style=\"");
+    if (attr_color) {
+      attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
+      W_L("color:");
+      W_V(attr_color);
+      W_L(";");
+    }
+    if (attr_size) {
+      W_L("font-size:");
+      W_V(attr_size);
+      W_L(";");
+    }
+    W_L("\"");
+  }
+  W_L(">");
   return xhtml->out;
 }
 
 
 /**
- * It is a handder who processes the DD tag.
+ * It is a handler who processes the DD tag.
  *
  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
  *                     destination is specified.
@@ -3070,6 +4600,9 @@ s_xhtml_1_0_end_dd_tag(void *pdoc, Node *UNUSED(child))
   xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc     *doc   = xhtml->doc;
   W_L("</dd>");
+  if (IS_CSS_ON(xhtml->entryp)) {
+    chxj_css_pop_prop_list(xhtml->css_prop_stack);
+  }
   return xhtml->out;
 }
 
@@ -3085,13 +4618,13 @@ s_xhtml_1_0_end_dd_tag(void *pdoc, Node *UNUSED(child))
 static char *
 s_xhtml_1_0_start_menu_tag(void *pdoc, Node *node)
 {
-  xhtml_t *xhtml = GET_XHTML(pdoc);
-  Doc     *doc   = xhtml->doc;
-  Attr    *attr;
-  W_L("<menu");
-  /*--------------------------------------------------------------------------*/
-  /* Get Attributes                                                           */
-  /*--------------------------------------------------------------------------*/
+  xhtml_t *xhtml      = GET_XHTML(pdoc);
+  Doc       *doc        = xhtml->doc;
+  Attr      *attr;
+  char      *attr_style = NULL;
+  char      *attr_color = NULL;
+  char      *attr_type  = NULL;
+  char      *attr_size  = NULL;
   for (attr = qs_get_attr(doc,node);
        attr;
        attr = qs_get_next_attr(doc,attr)) {
@@ -3099,11 +4632,77 @@ s_xhtml_1_0_start_menu_tag(void *pdoc, Node *node)
     char *value  = qs_get_attr_value(doc,attr);
     if (STRCASEEQ('t','T',"type",name)) {
       if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
-        W_L(" type=\"");
-        W_V(value);
-        W_L("\"");
+        attr_type = value;
       }
     }
+    else if (STRCASEEQ('s','S',"style", name) && value && *value) {
+      attr_style = value;
+    }
+  }
+  if (IS_CSS_ON(xhtml->entryp)) {
+    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *color_prop           = chxj_css_get_property_value(doc, style, "color");
+      css_property_t *size_prop            = chxj_css_get_property_value(doc, style, "font-size");
+      css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
+      css_property_t *cur;
+      for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          attr_color = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+      for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          attr_type = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+      for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          if (STRCASEEQ('x','X',"xx-small",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('x','X',"x-small",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('s','S',"small",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('m','M',"medium",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('l','L',"large",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('x','X',"x-large",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+        }
+      }
+    }
+  }
+  W_L("<menu");
+  if (attr_type || attr_color || attr_size) {
+    W_L(" style=\"");
+    if (attr_type) {
+      W_L("list-style-type:");
+      W_V(attr_type);
+      W_L(";");
+    }
+    if (attr_color) {
+      attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
+      W_L("color:");
+      W_V(attr_color);
+      W_L(";");
+    }
+    if (attr_size) {
+      W_L("font-size:");
+      W_V(attr_size);
+      W_L(";");
+    }
+    W_L("\"");
   }
   W_L(">");
   return xhtml->out;
@@ -3122,8 +4721,11 @@ static char *
 s_xhtml_1_0_end_menu_tag(void *pdoc, Node *UNUSED(child))
 {
   xhtml_t *xhtml = GET_XHTML(pdoc);
-  Doc *doc = xhtml->doc;
+  Doc     *doc = xhtml->doc;
   W_L("</menu>");
+  if (IS_CSS_ON(xhtml->entryp)) {
+    chxj_css_pop_prop_list(xhtml->css_prop_stack);
+  }
   return xhtml->out;
 }
 
@@ -3181,7 +4783,7 @@ s_xhtml_1_0_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
 
 
 /**
- * It is a hanblinker who processes the BLINK tag.
+ * It is a handler who processes the BLINK tag.
  *
  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
  *                     destination is specified.
@@ -3189,17 +4791,85 @@ s_xhtml_1_0_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
  * @return The conversion result is returned.
  */
 static char *
-s_xhtml_1_0_start_blink_tag(void *pdoc, Node *UNUSED(child))
+s_xhtml_1_0_start_blink_tag(void *pdoc, Node *node)
 {
-  xhtml_t *xhtml = GET_XHTML(pdoc);
-  Doc     *doc = xhtml->doc;
-  W_L("<blink>");
+  xhtml_t *xhtml      = GET_XHTML(pdoc);
+  Doc     *doc        = xhtml->doc;
+  Attr    *attr;
+  char    *attr_style = NULL;
+  char    *attr_color = NULL;
+  char    *attr_size  = NULL;
+
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) {
+    char *name   = qs_get_attr_name(doc,attr);
+    char *value  = qs_get_attr_value(doc,attr);
+    if (STRCASEEQ('s','S',"style", name) && value && *value) {
+      attr_style = value;
+    }
+  }
+  if (IS_CSS_ON(xhtml->entryp)) {
+    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *color_prop           = chxj_css_get_property_value(doc, style, "color");
+      css_property_t *size_prop            = chxj_css_get_property_value(doc, style, "font-size");
+      css_property_t *cur;
+      for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          attr_color = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+      for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          if (STRCASEEQ('x','X',"xx-small",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('x','X',"x-small",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('s','S',"small",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('m','M',"medium",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('l','L',"large",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('x','X',"x-large",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+        }
+      }
+    }
+  }
+  W_L("<blink");
+  if (attr_color || attr_size) {
+    W_L(" style=\"");
+    if (attr_color) {
+      attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
+      W_L("color:");
+      W_V(attr_color);
+      W_L(";");
+    }
+    if (attr_size) {
+      W_L("font-size:");
+      W_V(attr_size);
+      W_L(";");
+    }
+    W_L("\"");
+  }
+  W_L(">");
   return xhtml->out;
 }
 
 
 /**
- * It is a hanblinker who processes the BLINK tag.
+ * It is a handler who processes the BLINK tag.
  *
  * @param pdoc  [i/o] The pointer to the XHTML structure at the output
  *                     destination is specified.
@@ -3207,11 +4877,14 @@ s_xhtml_1_0_start_blink_tag(void *pdoc, Node *UNUSED(child))
  * @return The conversion result is returned.
  */
 static char *
-s_xhtml_1_0_end_blink_tag(void *pdoc, Node *UNUSED(child))
+s_xhtml_1_0_end_blink_tag(void *pdoc, Node *UNUSED(node))
 {
   xhtml_t *xhtml = GET_XHTML(pdoc);
-  Doc     *doc = xhtml->doc;
+  Doc     *doc   = xhtml->doc;
   W_L("</blink>");
+  if (IS_CSS_ON(xhtml->entryp)) {
+    chxj_css_pop_prop_list(xhtml->css_prop_stack);
+  }
   return xhtml->out;
 }
 
@@ -3227,10 +4900,16 @@ s_xhtml_1_0_end_blink_tag(void *pdoc, Node *UNUSED(child))
 static char *
 s_xhtml_1_0_start_marquee_tag(void *pdoc, Node *node)
 {
-  xhtml_t *xhtml = GET_XHTML(pdoc);
-  Doc     *doc = xhtml->doc;
-  Attr *attr;
-  W_L("<marquee");
+  xhtml_t   *xhtml = GET_XHTML(pdoc);
+  Doc       *doc = xhtml->doc;
+  Attr      *attr;
+  char      *attr_direction = NULL;
+  char      *attr_behavior  = NULL;
+  char      *attr_loop      = NULL;
+  char      *attr_style     = NULL;
+  char      *attr_color     = NULL;
+  char      *attr_size      = NULL;
+  char      *attr_bgcolor   = NULL;
   /*--------------------------------------------------------------------------*/
   /* Get Attributes                                                           */
   /*--------------------------------------------------------------------------*/
@@ -3240,35 +4919,135 @@ s_xhtml_1_0_start_marquee_tag(void *pdoc, Node *node)
     char *name   = qs_get_attr_name(doc,attr);
     char *value  = qs_get_attr_value(doc,attr);
     if (STRCASEEQ('d','D',"direction", name)) {
-      if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value))) {
-        W_L(" direction=\"");
-        W_V(value);
-        W_L("\"");
+      if (value) {
+        if (STRCASEEQ('l','L',"left",value)) {
+          attr_direction = "rtl";
+        }
+        else if (STRCASEEQ('r','R',"right",value)) {
+          attr_direction = "ltr";
+        }
       }
     }
-    else if (STRCASEEQ('b','B',"behavior",name)) {
-      if (value && (STRCASEEQ('s','S',"scroll",value) || STRCASEEQ('s','S',"slide",value) || STRCASEEQ('a','A',"alternate",value))) {
-        W_L(" behavior=\""); 
-        W_V(value);
-        W_L("\"");
+    else if (STRCASEEQ('b','B',"behavior",name) && value && *value) {
+      if (STRCASEEQ('s','S',"scroll",value) || STRCASEEQ('s','S',"slide",value) || STRCASEEQ('a','A',"alternate",value)) {
+        attr_behavior = value;
       }
     }
-    else if (STRCASEEQ('l','L',"loop",name)) {
-      if (value && *value) {
-        W_L(" loop=\"");
-        W_V(value);
-        W_L("\"");
-      }
+    else if (STRCASEEQ('l','L',"loop",name) && value && *value) {
+      attr_loop = value;
     }
     else if (STRCASEEQ('b','B',"bgcolor",name)) {
       if (value && *value) {
-        W_L(" bgcolor=\"");
-        W_V(value);
-        W_L("\"");
+        attr_bgcolor = value;
       }
     }
+    else if (STRCASEEQ('s','S',"style",name) && value && *value) {
+      attr_style = value;
+    }
+  }
+  if (IS_CSS_ON(xhtml->entryp)) {
+    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
+      css_property_t *size_prop  = chxj_css_get_property_value(doc, style, "font-size");
+      css_property_t *bgcolor_prop  = chxj_css_get_property_value(doc, style, "background-color");
+      css_property_t *direction_prop  = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
+      css_property_t *behavior_prop  = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
+      css_property_t *loop_prop  = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
+      css_property_t *cur;
+      for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          attr_color = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+      for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+      for (cur = direction_prop->next; cur != direction_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          attr_direction = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+      for (cur = behavior_prop->next; cur != behavior_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          if (STRCASEEQ('s','S',"scroll",cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
+            attr_behavior = apr_pstrdup(doc->pool, cur->value);
+          }
+        }
+      }
+      for (cur = loop_prop->next; cur != loop_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          attr_loop = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+      for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          if (STRCASEEQ('x','X',"xx-small",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('x','X',"x-small",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('s','S',"small",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('m','M',"medium",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('l','L',"large",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('x','X',"x-large",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+          else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+        }
+      }
+    }
+  }
+  W_L("<marquee");
+  if (attr_color || attr_size || attr_direction || attr_bgcolor || attr_behavior || attr_loop) {
+    W_L(" style=\"");
+    if (attr_direction) {
+      W_L("-wap-marquee-dir:");
+      W_V(attr_direction);
+      W_L(";");
+    }
+    if (attr_behavior) {
+      W_L("-wap-marquee-style:");
+      W_V(attr_behavior);
+      W_L(";");
+    }
+    if (attr_loop) {
+      W_L("-wap-marquee-loop:");
+      W_V(attr_loop);
+      W_L(";");
+    }
+    if (attr_bgcolor) {
+      attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
+      W_L("background-color:");
+      W_V(attr_bgcolor);
+      W_L(";");
+    }
+    if (attr_color) {
+      attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
+      W_L("color:");
+      W_V(attr_color);
+      W_L(";");
+    }
+    if (attr_size) {
+      W_L("font-size:");
+      W_V(attr_size);
+      W_L(";");
+    }
+    W_L("\"");
   }
   W_L(">");
+
   return xhtml->out;
 }
 
@@ -3287,6 +5066,9 @@ s_xhtml_1_0_end_marquee_tag(void *pdoc, Node *UNUSED(child))
   xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc     *doc = xhtml->doc;
   W_L("</marquee>");
+  if (IS_CSS_ON(xhtml->entryp)) {
+    chxj_css_pop_prop_list(xhtml->css_prop_stack);
+  }
   return xhtml->out;
 }
 
@@ -3299,7 +5081,354 @@ s_xhtml_1_0_newline_mark(void *pdoc, Node *UNUSED(node))
 {
   xhtml_t *xhtml = GET_XHTML(pdoc);
   Doc *doc = xhtml->doc;
-  W_NLCODE();
+  if (xhtml->start_html_flag) {
+    W_NLCODE();
+  }
+  return xhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the LINK tag.
+ *
+ * @param pdoc  [i/o] The pointer to the CHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The LINK tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_xhtml_1_0_link_tag(void *pdoc, Node *node)
+{
+  xhtml_t       *xhtml;
+  Doc           *doc;
+  Attr          *attr;
+  char          *rel  = NULL;
+  char          *href = NULL;
+  char          *type = NULL;
+
+  xhtml = GET_XHTML(pdoc);
+  doc   = xhtml->doc;
+
+  if (! IS_CSS_ON(xhtml->entryp)) {
+    return xhtml->out;
+  }
+
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) {
+    char *name  = qs_get_attr_name(doc,attr);
+    char *value = qs_get_attr_value(doc,attr);
+    if (STRCASEEQ('r','R',"rel", name)) {
+      if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
+        rel = value;
+      }
+    }
+    else if (STRCASEEQ('h','H',"href", name)) {
+      if (value && *value) {
+        href = value;
+      }
+    }
+    else if (STRCASEEQ('t','T',"type", name)) {
+      if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
+        type = value;
+      }
+    }
+  }
+
+  if (rel && href && type) {
+    DBG(doc->r, "start load CSS. url:[%s]", href);
+    xhtml->style = chxj_css_parse_from_uri(doc->r, doc->pool, xhtml->style, href);
+    DBG(doc->r, "end load CSS. url:[%s]", href);
+  }
+
+  return xhtml->out;
+}
+
+static css_prop_list_t *
+s_xhtml_1_0_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
+{
+  xhtml_t *xhtml = GET_XHTML(pdoc);
+  Doc *doc = xhtml->doc;
+  css_prop_list_t *last_css = NULL;
+  if (IS_CSS_ON(xhtml->entryp)) {
+    css_prop_list_t *dup_css;
+    css_selector_t  *selector;
+
+    last_css = chxj_css_get_last_prop_list(xhtml->css_prop_stack);
+    dup_css  = chxj_dup_css_prop_list(doc, last_css);
+    selector = chxj_css_find_selector(doc, xhtml->style, node);
+    if (selector) {
+      chxj_css_prop_list_merge_property(doc, dup_css, selector);
+    }
+    chxj_css_push_prop_list(xhtml->css_prop_stack, dup_css);
+    last_css = chxj_css_get_last_prop_list(xhtml->css_prop_stack);
+
+    if (style_attr_value) {
+      css_stylesheet_t *ssheet = chxj_css_parse_style_attr(doc, NULL, apr_pstrdup(doc->pool, node->name), NULL, NULL, apr_pstrdup(doc->pool, style_attr_value));
+      if (ssheet) {
+        chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
+      }
+    }
+  }
+  return last_css;
+}
+
+
+static css_prop_list_t *
+s_xhtml_1_0_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
+{
+  xhtml_t *xhtml = GET_XHTML(pdoc);
+  Doc *doc = xhtml->doc;
+  css_prop_list_t *last_css = NULL;
+  if (IS_CSS_ON(xhtml->entryp)) {
+    css_prop_list_t *dup_css;
+    css_selector_t  *selector;
+
+    last_css = chxj_css_get_last_prop_list(xhtml->css_prop_stack);
+    dup_css  = chxj_dup_css_prop_list(doc, last_css);
+    selector = chxj_css_find_selector(doc, xhtml->style, node);
+    if (selector) {
+      chxj_css_prop_list_merge_property(doc, dup_css, selector);
+    }
+    last_css = dup_css;
+
+    if (style_attr_value) {
+      css_stylesheet_t *ssheet = chxj_css_parse_style_attr(doc, NULL, apr_pstrdup(doc->pool, node->name), NULL, NULL, apr_pstrdup(doc->pool, style_attr_value));
+      if (ssheet) {
+        chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
+      }
+    }
+  }
+  return last_css;
+}
+
+
+/**
+ * It is a handler who processes the SPAN tag.
+ *
+ * @param pdoc  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The SPAN tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_xhtml_1_0_start_span_tag(void *pdoc, Node *node)
+{
+  xhtml_t *xhtml;
+  Doc *doc;
+  Attr *attr;
+  char *attr_style = NULL;
+  char *attr_color = NULL;
+  char *attr_size = NULL;
+  char *attr_align = NULL;
+  char *attr_blink = NULL;
+  char *attr_marquee = NULL;
+  char *attr_marquee_dir = NULL;
+  char *attr_marquee_style = NULL;
+  char *attr_marquee_loop = NULL;
+
+  xhtml = GET_XHTML(pdoc);
+  doc     = xhtml->doc;
+
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) {
+    char *nm  = qs_get_attr_name(doc,attr);
+    char *val = qs_get_attr_value(doc,attr);
+    if (val && STRCASEEQ('s','S',"style", nm)) {
+      attr_style = val;
+    }
+  }
+  if (IS_CSS_ON(xhtml->entryp)) {
+    css_prop_list_t *style = s_xhtml_1_0_push_and_get_now_style(pdoc, node, attr_style);
+    if (style) {
+      css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
+      css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
+      css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
+      css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
+      css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
+      css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
+      css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
+      css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
+      css_property_t *cur;
+      for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
+        attr_color = apr_pstrdup(doc->pool, cur->value);
+      }
+      for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          if ( STRCASEEQ('x','X',"xx-small",cur->value)
+            || STRCASEEQ('x','X',"x-small", cur->value)
+            || STRCASEEQ('s','S',"small",   cur->value)
+            || STRCASEEQ('m','M',"medium",  cur->value)
+            || STRCASEEQ('l','L',"large",   cur->value)
+            || STRCASEEQ('x','X',"x-large", cur->value)
+            || STRCASEEQ('x','X',"xx-large",cur->value)) {
+            attr_size = apr_pstrdup(doc->pool, cur->value);
+          }
+        }
+      }
+      for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
+        if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
+          attr_blink = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+      for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
+        if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
+          attr_marquee = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+      for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          if ( STRCASEEQ('l','L',"ltr",cur->value)
+            || STRCASEEQ('r','R',"rtl",cur->value)) {
+            attr_marquee_dir = apr_pstrdup(doc->pool, cur->value);
+          }
+        }
+      }
+      for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          if ( STRCASEEQ('s','S',"scroll",cur->value)
+            || STRCASEEQ('s','S',"slide",cur->value)
+            || STRCASEEQ('a','A',"alternate",cur->value)) {
+            attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
+          }
+        }
+      }
+      for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
+        if (cur->value && *cur->value) {
+          attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
+        }
+      }
+      for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
+        if (STRCASEEQ('l','L',"left", cur->value)) {
+          attr_align = apr_pstrdup(doc->pool, "left");
+        }
+        else if (STRCASEEQ('c','C',"center",cur->value)) {
+          attr_align = apr_pstrdup(doc->pool, "center");
+        }
+        else if (STRCASEEQ('r','R',"right",cur->value)) {
+          attr_align = apr_pstrdup(doc->pool, "right");
+        }
+      }
+    }
+  }
+
+  W_L("<span");
+  if (attr_color || attr_size || attr_align || attr_blink || attr_marquee) {
+    W_L(" style=\"");
+    if (attr_color) {
+      attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
+      W_L("color:");
+      W_V(attr_color);
+      W_L(";");
+    }
+    if (attr_size) {
+      W_L("font-size:");
+      W_V(attr_size);
+      W_L(";");
+    }
+    if (attr_align) {
+      W_L("text-align:");
+      W_V(attr_align);
+      W_L(";");
+    }
+    if (attr_blink) {
+      W_L("text-decoration:");
+      W_V("blink");
+      W_L(";");
+    }
+    if (attr_marquee) {
+      W_L("display:-wap-marquee;");
+      if (attr_marquee_dir) {
+        W_L("-wap-marquee-dir:");
+        W_V(attr_marquee_dir);
+        W_L(";");
+      }
+      if (attr_marquee_style) {
+        W_L("-wap-marquee-style:");
+        W_V(attr_marquee_style);
+        W_L(";");
+      }
+      if (attr_marquee_loop) {
+        W_L("-wap-marquee-loop:");
+        W_V(attr_marquee_loop);
+        W_L(";");
+      }
+    }
+    W_L("\"");
+  }
+  W_L(">");
+  return xhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the SPAN tag.
+ *
+ * @param pdoc  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The SPAN tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_xhtml_1_0_end_span_tag(void *pdoc, Node *UNUSED(node))
+{
+  xhtml_t *xhtml = GET_XHTML(pdoc);
+  Doc *doc = xhtml->doc;
+
+  W_L("</span>");
+  if (IS_CSS_ON(xhtml->entryp)) {
+    chxj_css_pop_prop_list(xhtml->css_prop_stack);
+  }
+  return xhtml->out;
+}
+
+
+/**
+ * It is a handler who processes the STYLE tag.
+ *
+ * @param pdoc  [i/o] The pointer to the XHTML structure at the output
+ *                     destination is specified.
+ * @param node   [i]   The STYLE tag node is specified.
+ * @return The conversion result is returned.
+ */
+static char *
+s_xhtml_1_0_style_tag(void *pdoc, Node *node)
+{
+  xhtml_t     *xhtml;
+  Doc           *doc;
+  Attr          *attr;
+  char          *type = NULL;
+
+  xhtml = GET_XHTML(pdoc);
+  doc     = xhtml->doc;
+
+  if (! IS_CSS_ON(xhtml->entryp)) {
+    return xhtml->out;
+  }
+
+  for (attr = qs_get_attr(doc,node);
+       attr;
+       attr = qs_get_next_attr(doc,attr)) {
+    char *name  = qs_get_attr_name(doc,attr);
+    char *value = qs_get_attr_value(doc,attr);
+    if (STRCASEEQ('t','T',"type", name)) {
+      if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
+        type = value;
+      }
+    }
+  }
+
+  Node *child = qs_get_child_node(doc, node);
+  if (type && child) {
+    char *name  = qs_get_node_name(doc, child);
+    if (STRCASEEQ('t','T',"text", name)) {
+      char *value = qs_get_node_value(doc, child);
+      DBG(doc->r, "start load CSS. buf:[%s]", value);
+      xhtml->style = chxj_css_parse_style_value(doc, xhtml->style, value);
+      DBG(doc->r, "end load CSS. value:[%s]", value);
+    }
+  }
   return xhtml->out;
 }
 /*