* VT.ref * Interpretation of XSLT * Trancformation + Validation *$MST_FROM_ENTRY; *$CALL_DEPTH 0; *$DEPTH 0; *$LENGTH 0; $ENTRY VT { ((s.tag) e.xml) = <Int (<Template_ s.tag>) ((s.tag) e.xml) ( )>; } Apply { = ; s.text e.xml = s.text <Apply e.xml>; ((s.tag e.attr) e.xml1) e.xml2 = <Int (<Template_ s.tag>) ((s.tag e.attr) e.xml1) ( )> <Apply e.xml2>; } Int { ( ) (e.xml) (e.var) = ; ( s.text e.xslt) (e.xml) (e.var) = s.text <Int (e.xslt) (e.xml) (e.var)>; ( ((s.a e.1) e.xslt1) e.xslt2) (e.xml) (e.var) = ((s.a e.1) <Int (e.xslt1) (e.xml) (e.var)> ) <Int (e.xslt2) (e.xml) (e.var)>; ( (((xsl variable) (name (s.name))) e.1) e.xslt) (e.xml) (e.var) = <Int (e.xslt) (e.xml) ( ((s.name) <Int (e.1) (e.xml) (e.var)>) )>; ( (((xsl s.op) e.xslt) e.2) e.3) (e.xml) (e.var) = <IntXsl (((xsl s.op) e.xslt) e.2) (e.xml) (e.var)> <Int (e.3) (e.xml) (e.var)>; } * -------------------------------------------------------- * One rule of transformation * -------------------------------------------------------- IntXsl { ( ((xsl apply-templates)) ) ((s.tag e.attr) e.xml) (e.var) = <Apply <DelTop <IntDTD ((s.tag e.attr) e.xml)>>>; ( ((xsl apply-templates) (select e.path)) e.2) (e.xml) (e.var) = <Apply <Select (e.path) (e.xml) (e.var)>>; ( ((xsl call-template) (name (e.name)))) (e.xml) (e.var) = <Int (<Template_ e.name> ) (e.xml) (e.var)>; ( ((xsl call-template) (name (s.name))) ( ((xsl with-param) (name (s.name1))) e.1) ) (e.xml) (e.var) = <Template (s.name) (s.name1) (e.1) (e.xml) (e.var)>; ( ((xsl choose)) e.xslt) (e.xml) (e.var) = <Choose (e.xslt) (e.xml) (e.var)>; ( ((xsl copy-of) (select e.path)) ) (e.xml) (e.var) = <SelectZ (e.path) (e.xml) (e.var)>; ( ((xsl element) (name (e.name1 )) ) ( ((xsl attribute) (name (e.name2 )) ) e.xslt1) e.xslt2) (e.xml) (e.var) = ((e.name1 (e.name2 <Int (e.xslt1) (e.xml) (e.var)> )) <Int (e.xslt2) (e.xml) (e.var)>); ( ((xsl for-each) (select e.path)) e.xslt) (e.xml) (e.var) = <For_each (e.xslt) <Select (e.path) (e.xml) (e.var)> (e.var)>; ( ((xsl if) (test (e.1) (e.2) (e.3))) e.xslt) (e.xml) (e.var) = <If1 <If (e.1) (<Value <SelectZ (e.2) (e.xml) (e.var)>>) (<Value <SelectZ (e.3) (e.xml) (e.var)>>) (e.xslt) (e.xml) (e.var)>>; ( ((xsl param) e.attr) e.1) (e.xml) (e.var) = ; ( ((xsl text) ) s.text) (e.xml) (e.var) = s.text; ( ((xsl value-of) (select e.path)) ) (e.xml) (e.var) = <Value <SelectZ (e.path) (e.xml) (e.var)>>; } * ================================================= Value { s.text e.xml = s.text; = ; ((e.tag) s.text) e.xml = s.text ; } Eq { (s.a) (s.a) = T; ( ) ( ) = T; (e.a) (e.b) = F; } DelTop { ((s.tag e.attr) e.xml) = e.xml; } * ================================================= Choose { (( ((xsl when) (test (e.1) (e.2) (e.3))) e.xslt1) e.xslt2)(e.xml) (e.var) = <Choose1 <If (e.1) (<Value <SelectZ (e.2) (e.xml) (e.var)>>) (<Value <SelectZ (e.3) (e.xml) (e.var)>>) (e.xslt1) (e.xslt2) (e.xml) (e.var)>>; (( ((xsl otherwise)) e.xslt)) (e.xml) (e.var) = <Int (e.xslt) (e.xml) (e.var)>; ( ) (e.xml) (e.var) = ; } Choose1 { T (e.xslt1) (e.xslt2) (e.xml) (e.var) = <Int (e.xslt1) (e.xml) (e.var)>; F (e.xslt1) (e.xslt2) (e.xml) (e.var) = <Choose (e.xslt2) (e.xml) (e.var)>; } * =================================================== If { ('!=') (e.1) (e.2) e.34 = <Not <Eq (e.1) (e.2)>> e.34; ( '=') (e.1) (e.2) e.34 = <Eq (e.1) (e.2)> e.34; } If1 { T (e.xslt) (e.xml) (e.var) = <Int (e.xslt) (e.xml) (e.var)>; F (e.xslt) (e.xml) (e.var) = ; } Not { T = F; F = T; } * ================================================== For_each { (e.xslt) (e.var) = ; (e.xslt) (e.xml1) e.xml2 (e.var) = <Int (e.xslt) (e.xml1) (e.var)> <For_each (e.xslt) e.xml2 (e.var)>; } * =================================================== Template { (s.name) (s.name1) (e.1) (e.xml) (e.var) = <Int ( <Template_ s.name (<Int (e.1) (e.xml) (e.var) >)> ) (e.xml) (e.var)>; } * =================================================== Select { (('$' s.name (e.1)) e.path) (e.xml) (e.var) = <Select1_node (e.path) e.1>; (("xt:node-set" ('$' s.name (e.1))) e.path) (e.xml) (e.var) = <Select1_node (e.path) e.1>; (("xt:node-set" ('$' s.name)) e.path) (e.xml) (((s.name) e.var)) = <Select1_node (e.path) e.var>; (('$' s.name) e.path) (e.xml) (((s.name) e.var)) = <Select1_node (e.path) e.var>; (('.')) (e.xml) (e.var) = (e.xml); ((text s.text )) (e.xml) (e.var) = s.text; (e.path) (e.xml) (e.var) = <Select2 (e.path) (e.xml)>; } Select1_node { ( ) e.1 = e.1; ((s.name) e.path) e.1 = <Select1 (e.path) <SelectA_node (s.name) <IntDTD e.1>>>; } Select1 { (e.path) = ; (e.path) (e.xml1) e.xml2 = <Select2 (e.path) (e.xml1)> <Select1 (e.path) e.xml2>; } Select2 { ( ) e.xml = e.xml; ((e.1)) (e.xml) = <SelectA (e.1) <IntDTD (e.xml)>>; ((e.1) e.3) (e.xml) = <Select1 (e.3) <SelectA (e.1) <IntDTD (e.xml)>>>; } SelectA { ('@' s.name) ((s.tag e.attr) e.xml) = <GetAttr s.name e.attr>; (s.name) ((e.tag)) = ; (s.name) ((e.tag) ((s.name e.attr) e.xml1) e.xml2) = ((s.name e.attr) e.xml1) <SelectA (s.name) ((e.tag) e.xml2)>; (s.name) ((e.tag) (e.xml1) e.xml2) = <SelectA (s.name) ((e.tag) e.xml2)>; } SelectA_node { ('@' s.name) ((s.tag e.attr) e.xml) = <GetAttr s.name e.attr>; (s.name) = ; (s.name) ((s.name e.attr) e.xml1) e.xml2 = ((s.name e.attr) e.xml1) <SelectA_node (s.name) e.xml2>; (s.name) ((s.tag2 e.attr) e.xml1) e.xml2 = <SelectA_node (s.name) e.xml2>; } * ===================================================== SelectZ { e.1 = <Firstt <Select e.1>>; } GetAttr { s.name = ; s.name (s.name ) e.2 = ; s.name (s.name s.text) e.2 = s.text; s.name (s.name1 e.1) e.2 = <GetAttr s.name e.2>; } ValueAttr { (t.a e.1) e.2 = e.1 <ValueAttr e.2>; = ; } Firstt { = ; s.1 e.2 = s.1; (e.1) e.2 = (e.1); } Const__ { e.1 = e.1; } * ====================================================== * Validate * ====================================================== IntDTD { ((s.tag e.attr) e.xml) = ((<Tag s.tag e.attr>) <TUR (Q1) (e.xml) (<DTD_ s.tag>) > ); } TUR { (s.q) ( ) (e.aut) = <Search_Empty (s.q) (e.aut)>; (s.q) (s.text e.xml) (e.aut) = s.text <TUR <Search_PCDATA (s.q) (e.aut)> (e.xml) (e.aut)>; * It is local Filtr (s.q) (((s.tag e.attr) e.xml1) e.xml2) (e.aut) = <TTT <Search (s.q) (s.tag) (e.aut)> (((s.tag e.attr) e.xml1) e.xml2) (e.aut)>; } TTT { (s.r) (((s.tag e.attr) e.xml1) e.xml2) (e.aut) = ((<Tag s.tag e.attr>) e.xml1) <TUR (s.r) (e.xml2) (e.aut)>; } Tag { s.tag e.attr = <Attr (s.tag e.attr) (<DTD_ s.tag>)>; } Attr { (s.tag) ((ATTLIST e.Attlist) e.aut) = <RI >; (s.tag e.attr) ((ATTLIST e.Attlist) e.aut) = s.tag <Attr1 e.attr (e.Attlist)>; (s.tag) (e.aut) = s.tag; } Attr1 { (s.attr e.v) e.1 ((s.attr) e.Attlist) = (s.attr e.v) <Attr1 e.1 (e.Attlist)>; ( ) = ; } RI { RI = RI; } * Поиск в конечном автомате ребра перехода. Search { (s.q) (s.tag) ((ATTLIST e.att) e.2) = <Search (s.q) (s.tag) (e.2)>; (s.q) (s.tag) ((s.q PCDATA s.r) e.2) = <Search (s.q) (s.tag) (e.2)>; (s.q) (s.tag) ((s.q EMPTY s.r) e.2) = <Search (s.q) (s.tag) (e.2)>; (s.q) (s.tag) ((s.q s.tag s.r) e.2) = (s.r); (s.q) (s.tag) ((e.1) e.2) = <Search (s.q) (s.tag) (e.2)>; } Search_PCDATA { (s.q) ((s.q PCDATA s.r) e.2) = (s.r); (s.q) ((e.1) e.2) = <Search_PCDATA (s.q) (e.2)>; } Search_Empty { (s.q) ((s.q EMPTY T ) e.2) = ; (s.q) ((e.1) e.2) = <Search_Empty (s.q) (e.2)>; }