diff --git a/src/dom/sgml/parser.c b/src/dom/sgml/parser.c index 2602028e2..70903fc59 100644 --- a/src/dom/sgml/parser.c +++ b/src/dom/sgml/parser.c @@ -151,9 +151,7 @@ parse_sgml_attributes(struct dom_stack *stack, struct dom_scanner *scanner) assert(dom_scanner_has_tokens(scanner) && (get_dom_scanner_token(scanner)->type == SGML_TOKEN_ELEMENT_BEGIN - || (get_dom_stack_top(stack)->node->type == DOM_NODE_PROCESSING_INSTRUCTION - && get_dom_stack_top(stack)->node->data.proc_instruction.type - == DOM_PROC_INSTRUCTION_XML))); + || (get_dom_stack_top(stack)->node->type == DOM_NODE_PROCESSING_INSTRUCTION))); if (get_dom_scanner_token(scanner)->type == SGML_TOKEN_ELEMENT_BEGIN) skip_dom_scanner_token(scanner); @@ -279,6 +277,7 @@ parse_sgml_plain(struct dom_stack *stack, struct dom_scanner *scanner) skip_dom_scanner_token(scanner); break; + case SGML_TOKEN_PROCESS_XML_STYLESHEET: case SGML_TOKEN_PROCESS_XML: case SGML_TOKEN_PROCESS: copy_struct(&target, token); @@ -290,7 +289,8 @@ parse_sgml_plain(struct dom_stack *stack, struct dom_scanner *scanner) assert(token->type == SGML_TOKEN_PROCESS_DATA); if (add_sgml_proc_instruction(stack, &target, token) - && target.type == SGML_TOKEN_PROCESS_XML + && (target.type == SGML_TOKEN_PROCESS_XML + || target.type == SGML_TOKEN_PROCESS_XML_STYLESHEET) && token->string.length > 0) { /* Parse the . */ struct dom_scanner attr_scanner; diff --git a/src/dom/sgml/scanner.c b/src/dom/sgml/scanner.c index 8a51aab86..65a04752c 100644 --- a/src/dom/sgml/scanner.c +++ b/src/dom/sgml/scanner.c @@ -47,13 +47,14 @@ static struct dom_scan_table_info sgml_scan_table_info[] = { { INIT_DOM_STRING(str, -1), SGML_TOKEN_##type, SGML_TOKEN_##family } static struct dom_scanner_string_mapping sgml_string_mappings[] = { - SGML_STRING_MAP("--", NOTATION_COMMENT, NOTATION), - SGML_STRING_MAP("ATTLIST", NOTATION_ATTLIST, NOTATION), - SGML_STRING_MAP("DOCTYPE", NOTATION_DOCTYPE, NOTATION), - SGML_STRING_MAP("ELEMENT", NOTATION_ELEMENT, NOTATION), - SGML_STRING_MAP("ENTITY", NOTATION_ENTITY, NOTATION), + SGML_STRING_MAP("--", NOTATION_COMMENT, NOTATION), + SGML_STRING_MAP("ATTLIST", NOTATION_ATTLIST, NOTATION), + SGML_STRING_MAP("DOCTYPE", NOTATION_DOCTYPE, NOTATION), + SGML_STRING_MAP("ELEMENT", NOTATION_ELEMENT, NOTATION), + SGML_STRING_MAP("ENTITY", NOTATION_ENTITY, NOTATION), - SGML_STRING_MAP("xml", PROCESS_XML, PROCESS), + SGML_STRING_MAP("xml", PROCESS_XML, PROCESS), + SGML_STRING_MAP("xml-stylesheet", PROCESS_XML_STYLESHEET, PROCESS), DOM_STRING_MAP_END, }; diff --git a/src/dom/sgml/scanner.h b/src/dom/sgml/scanner.h index 9abe59e32..492cb2640 100644 --- a/src/dom/sgml/scanner.h +++ b/src/dom/sgml/scanner.h @@ -29,6 +29,7 @@ enum sgml_token_type { SGML_TOKEN_PROCESS, /* */ SGML_TOKEN_ELEMENT, /* <{ident}> */ diff --git a/src/dom/test/test-sgml-parser-basic b/src/dom/test/test-sgml-parser-basic index 58635e8eb..6805861ec 100755 --- a/src/dom/test/test-sgml-parser-basic +++ b/src/dom/test/test-sgml-parser-basic @@ -148,7 +148,6 @@ entity-reference: # #text: - entity-reference: #xx' -# Test test_output_equals \ 'Parse processing instructions.' \ ' @@ -170,6 +169,14 @@ proc-instruction: xml -> version="1.0" /> attribute: version -> 1.0 proc-instruction: xml -> /' +test_output_equals \ +'Parse XML stylesheet processing instructions.' \ +'' \ +' +proc-instruction: xml-stylesheet -> type="text/xsl" href="url" + attribute: type -> text/xsl + attribute: href -> url' + test_output_equals \ 'Parse exotic processing instructions.' \ '+?>-?>---' \