Transcript

XSLT (fb2) |

XSLT (fb2): [] [] [] [] [] [] []: [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] ... XSLT (fb2) XSLT () () - XSLT

? , - XML ( . extensible Markup Language). XML- . , XML . XML XML , . , XSLT. XSLT ( . extensible Stylesheet Language for Transformations), . XSLT , . XML , , . : , , , . , , , , . , Web- , , . , XML, . XML- , , . , - ., L- . . , ( HTML). , . , XML- (, , Java, Pascal) . , , . , XSLT. XSLT XML-, , . XSLT , XML. XSLT , XML, SQL, . XSLT XPath ( . XML Path Language XML-), XML-. XPath XSLT , XML-, XSLT XML-, XPointer XQuery. XSLT . XSLT " , ". , , XSLT ., ( XSLT, , , ) . , XSLT , . , XSLT- , , Java ++. XSLT , , , . , XSLT . , XSLT, . , " ?" : XML- , , . XSLT XPath, , XML- , .

? , XML, Web- Web-, Web-, , XML XML-. XSLT XPath , - , , , , , , . XSLT Lisp Prolog. , , , XSLT . , XSLT , , . : XSLT , . web- web- HTML . XSLT . , , Object Pascal, ++, Java, JavaScript, VBScript, Python PL/SQL. XSLT. Java, .

? , XSLT XPath, , . . , XML XSLT, , XSLT , . , , , . , http://xpath.info . 1 XSLT- . , , , . , XSLT , Saxon Windows Instant Saxon. . , , , , . . Saxon Java, Java- . , Saxon . Saxon http://saxon.sourceforge.net. Windows Instant Saxon, saxon.exe. Instant Saxon, :saxon - result.xml source.xml stylesheet.xsl, result.xml , source.xml , a stylesheet.xsl . 6, 7 8, 2 3. .

, .

1. XML XSLT XML ( . extensible Markup Language ). XML , XSLT XSLT XML. , XML , , . XML , W3, XSLT . L-, XML, , . XML , XML-. XML.

2. XSLT XSLT. , , XSLT . XSLT . XSLT. XSLT.

3. XSLT , XSLT. XML-, , XSLT XPath, , , . , XSLT "". , .

4. , XSLT, . , , . , .

5. , , : , , , , . .

6. XPath- XPath, XSLT L-. XPath- XSLT XPath.

7. XSLT XSLT , , , , . " ", , , .

8. XSLT , XSLT. , , . , , XML-, .

9. XSLT , XSLT . , Object Pascal, C/C++, VBScript, JavaScript, Java .

10. XSLT . , Saxon, Xalan Oracle XSLT Processor, , , .

11. , . , -: , , .

12. , XSLT . , , , XSLT 1.1, , . XSLT.

1. XSLT- XSLT- , . , XSLT-.

2. XSLT XSLT. .

3. XSLT XPath XPath XSLT, .

4. -, XSLT -, XSLT. , XSLT, , W3 .

- , XSLT, XML L-, XPath. . - (, , -, Extended Backus-Naur Form, EBNF). EBNF , -60. - . EBNF- W3, . EBNF , ( ) ( ), . , "::=": ::= , , . EBNF , , , XSLT., , , EBNF :#xN, N , Unicode N. , #410 (. " Unicode" 1).[a-zA-z], [#xN-#xN] . , [a-f] , b, , d, e, f.[abc], [#xN#xN#xN] . , [#410#411#412] , , . .[^a-z], [^#N-#xN] , . , [^#410-#x42F] , .[^abc], [^#xN#xN#xN] , . , [^xyz] , x,y z. , ."" , . , "stylesheet" stylesheet.'' , . , 'template' template. .A? , A .A | B A, B, ( ""). .A B , A B. A B | C D A B C D.A - B , A, B.A+ A. "+" EBNF , A+ | B+ A B.A* A. "+", "*" () . , , , , . , A B C | B C | A D C | D C | C (A? (B | D) ) C. - , , . , . Digits XPath. Digits 0 9 :Digits ::= [0-9] + , , . , , :[31] Digits ::= [0-9]+ Digits , Number, . , :[30] Number ::= Digits ('.' Digits?)?| '.' Digits EBNF, . Digits? , Digits , , ('.' Digits?) ? '.' ? | ('.' Digits)?. , Number :Number ::= Digits | Digits '.' Digits | Digits '.' | '.' Digits, : , 12345; , , 3.14; , , 6. 6.0; , , .5, 0.5. XPath . XPath , , .. , , , (, 'ab'cd'). Literal :[29] Literal ::= '"' [^"]* '"' | "'" [^']* "'" ('"'), , , ([^"]*), ('"'). . , (. space whitespace). XML- , , , . S , :[3] S ::= (#20 | #9 | #xD | #)+ , EBNF- XML- , , . , .

, . , XML- Courier. 2.1.

XML- , , :

, , . :

, , . "", "", :

, , . , : XSLT ( . extensible Stylesheet Language for Transformations ). , , [ 2001]. .

, (DBS) (Forschungszentrum Informatik, FZI) ., . , , . ( XSLT- Saxon XSLT), ( XML- Oracle), (Crane Softwrights Ltd.), (MultiConn International Ltd.) , . fido7.ru.xml, comp.text.xml XSL List, , XSLT- . , , . .. .X. , , . "-": , ., , , , .

1 XML

XML? , , . , , , , , . . , , - , , , , " ?". , , - , , , . , , , "0" ( , "" "") "1" ("", ""). , . , , , . . , , , , () . . , , , , . , . , , , . , ., , , " , ?" " , A?". , , . , , ( ), , , . XML (extensible Mark-up Language) . XML , , , .

. : 3- "" 250 . 4500 ! , , 3- , ! 091-12-15. "-". - Web-, , : 3- "" 250 . 4500 ! , , 3- , ! 091-12-15. "-". , , . , (, , ). , , HTML . HTML , : , ;
; ; ; . . (, ) , (,
) . . 1.1. HTML- 3- "" 250 . 4500 ! , , 3- , ! 091-12- 15.

"-". , , . , , . " " " ", , . , , . , . , XML , , . . 1.2 XML-

3-x "" 250 . 4500! , ,3-x , ! 0-91-12-15. "-".

: , , . . , , , , , , , , , . : , . , , . . , . , , , . , , . XML (. extensible Mark-up Language, ) , . XML, HTML, . , , , HTML , , XML , .

XML XML , . XML , , , . XML-, :

!

XML-, . . , title "". " !". , , .XML , HTML, XML . advert:

!

product:

!

, product advert. , HTML , XML , . XML, .

XML , , , , . , , , . XML-.

XML- , . XML , . , , , , .. :


:

... ...

sometext

, , , X="" . XML -, MyElement, myelement MYELEMENT . , XML , . XML. , . , , , : , , , , , . (. 1.1) .

. 1.1. , XML- . , . XML . . EBNF-, , :[39] element ::= EmptyElemTag | STag content ETag EmptyElemTag. ( STag), (content) (ETag). (Name) (Attribute), :[40] STag ::= '' . , :

("/") :[42] ETag ::= '' . ( element), (Reference), (CDSect), (PI) (Comment), (CharData):[43] content ::= CharData? ((element | Reference | CDSect | PI | Comment) CharData?)* EmptyElemTag :[44] EmptyElemTag ::= '' , , ("/"). , , XML HTML. , XML . HTML XML, XHTML. XML, XHTML- XML-, XHTML HTML. , XHTML. ( HTML): ,
. :
, , .

. :="", ! href, "http://www.xsltdev.ru". XML . , selected

XML , . , HTML . :

, , :

(, ). , :

login "scott" ( ), password 'tiger' ( ). XML . , , , :[41] Attribute ::= Name Eq Attribute[25] Eq ::= S? '=' S?[10] AttValue ::= '"' ([^' (S (Char* - (Char* '?>' Char*)))? , , , '?>', . ( "xml" ). EBNF- PITarget:[17] PITarget ::= Name - (('X' | '') ('' | 'm') ('L' | 'l')) XML , L- (XML declaration). :

, XML- , . , XML- : . XML- version, encoding standalone, . , XML-, . ="" . version XML, . XML 1.0, version="1.0".

encoding , . Unicode- UTF-8 ( . " Unicode"), , , . , , windows-1251 KOI8-R; XML- :

. , 127 ASCII, , , #x7F, encoding . UTF-8 ASCII. standalone , - . , XML- , . standalone, "yes", , , , , . XML XMLDecl, , , :[23] XMLDecl ::= '' VersionInfo version:[24] VersionInfo ::= S? 'version' Eq ("'" VersionNum "'" | "" VersionNum "") , "_", ".", ":" "-":[26] VersionNum ::= ([a-zA-Z0-9_.:] | '-')+ EncodingDecl, VersionInfo:[80] EncodingDecl ::= S? 'encoding' Eq ("'" EncName "'" | '"' EncName '"') , EncName, , ".", "_" "-", :[81] EncName [A-Za-z] ([A-Za-z0-9.-] | '-')* , . . , IANA (Internet Assigned Numbers Authority ). , , IANA . :Windows-1251;KOI8-R;Cp866;ISO-8859-5. XML , . , , "x-", :

standalone EBNF- SDDecl:[32] SDDecl ::= S 'standalone' Eq (("'" ('yes' | 'no') "'") | ( '"' ('yes' | 'no') '"' ) ) : standalone yes no, .

DATA CDATA , . CDATA "character data" . CDATA :

XML , , . , , CDATA. ! . , !]]> . "", .

(comments) XML- , :

, ("--"). , "-" . :...

... XML Comment :[15] Comment ::= '' ((Char - '-') | ('-' (Char - '-')))* , "-" .

XML . XML . Web-, http://www.xml.org, http://www.schema.net http://www.ebxml.org . . , . , . , , , , , . XML (. namespaces). , (URI). , , URI . URI URL Web-. , - , . XSLT, , :http://www.w3.org/1999/XSL/Transform , , . , xmlns, :

...

XSLT xsl, , , :

...

. , :

...

, , , , .

...

, , . , , .

...

stylesheet template , , , . . , , , .

...

.

...

. : ...

, xmlns .

, XML- , . , " " , , " template XSLT", , template XSLT . , , XML, "Namespaces in XML" ( XML), http://www.w3.org/TR/REC-xml-names. XML, [NS1], [NS2] . NSAttName , :[NS1] NSAttName ::= PrefixedAttName | DefaultAttName[NS2] PrefixedAttName ::= 'xmlns:' NCName[NS3] DefaultAttName ::= 'xmlns' NCName, PrefixedAttName, , . , Name , :[NS4] NCName ::= (Letter | '_') (NCNameChar)*[NS5] NCNameChar ::= Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender

. , www:template, xsl:template template , , , . XML- , , : , .

, stylesheet http://www.w3.org/1999/XSL/Transform. , , , . . ( ), . , , QName:[NS6] QName ::= (Prefix ':')? LocalPart Prefix , , LocalPart .[NS7] Prefix ::= NCName[NS8] LocalPart ::= NCName

XML- XML , . , , , . , , , , , , . XML , DTD (document type declaration). , 2001 XML- (XML Schema), , , . L- DTD.

(DTD) - . , DTD :ELEMENT ;ATTLIST ;ENTITY ;NOTATION . DOCTYPE :

..]> :

:

..]> EBNF-:[28] doctypedecl ::= '', Name, DOCTYPE, L-. advert. (S ExternalID) ? , (, ), ExternalID.[75] ExternalID ::= 'SYSTEM' S SystemLiteral | 'PUBLIC' S PubidLiteral S SystemLiteral ("SYSTEM"), SystemLiteral URI . , PubidLiteral, . DTD . , , XHTML, :

, , , XHTML, , . XHTML, http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd. , , , , DTD. ('[' (markupdecl | DeclSep) * ']' S?) ? doctypedecl , markupdecl DeclSep. , markupdecl, , DTD:[29] markupdecl ::= elementdecl | AttlistDecl| EntityDecl | NotationDecl | PI | Comment PI Comment , DTD . elementdecl, AttlistDecl, EntityDecl NotationDecl , , . . DeclSep , DTD. , :[28] DeclSep ::= PEReference | S , DTD -, markupdecl.

:

, ("_") (":") , , (, "_" , ":" , "." , "-" ) (. . " L" ). "A", "B:12", "MyEasyName", "doc.xml". :EMPTY, , ;ANY, , ; , , , , . . :

]> advert, product classified, advert product , classified . , . 1.3.

]>

!

, , -. , EBNF , , , ., , - "*", "?", "+", :? , ; , ;* ;a+ . , . , (a, b, c) , a, b, c. , a, b c. , , '|'. , (a | b | c) a, b c. .(a* | b? | | d+) , , a b, , , , d. , .((a | b), ( | d)) , a b, d. , #PCDATA (parsable character data ).

, product . . . (#PCDATA | ... | ... ) *. . ., : advert; advert , product classified, ; product product ; classified . . 1.4

]>

!

EBNF- elementdecl:[45] elementdecl ::= '' contentspec, , , :[46] contentspec ::= 'EMPTY' | 'ANY' | Mixed | children "EMPTY" , "ANY" , Mixed , children , .[47] children ::= (choice | seq) ('?' | '*' | '+')?[48] cp ::= (Name | choice | seq) ('?' | '*' | '+')?[49] choice ::= '(' S? cp ( S? '|' S? cp )+ S? ')'[50] seq ::= '(' S? cp ( S? ',' S? cp )* S? ')'[51] Mixed ::= '(' S? '#PCDATA' (S? '|' S? Name)* S? ')*' | '(' S? '#PCDATA' S? ')'

:

1 1 12 2 2 . ...> , , , . XML , , . :CDATA ;ID ;IDREF ;IDREFS ;ENTITY ;ENTITIES ;NMTOKEN ;NMTOKENS ;NOTATION ; . ID, XML-. ID , . , ID, . ID- , . , XPath, id, , , ID- . , ID , . XML- ID- . ID - XML-, , . , ID IDREF ( ) IDREFS ( ). , . : #REQUIRED, , ; #IMPLIED, , ; #FIXED, , , ;, , .

title CDATA #REQUIREDid ID #IMPLIEDquantity CDATA "1"value CDATA #FIXED ""color (|) ""> product : title, ; id, ; quantity, 1; value, ""; color, "" "", "". . :[52] AttlistDecl ::= '' Name , a AttDef* . AttDef:[53] AttDef ::= S Name S AttType S DefaultDecl Name , AttType , a DefaultDecl .[54] AttType ::= StringType | TokenizedType | EnumeratedType , (StringType), (TokenizedType) (EnumeratedType).[55] StringType ::= 'CDATA'[56] TokenizedType ::= 'ID' | 'IDREF' | 'IDREFS' | 'ENTITY'| 'ENTITIES' | 'NMTOKEN' | 'NMTOKENS' (EnumeratedType) (NotationType) (Enumeration):[57] EnumeratedType ::= NotationType | Enumeration[58] NotationType ::= 'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')' , "|". , ( | ).[59] Enumeration ::= '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')' DefaultDecl :[60] DefaultDecl ::= '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)? AttValue)

, XML , . XML "-". . . , , . :

&; (, , ).

]>

&animal;!

animal "". title product.

!

, , , , , , :

]>

&animal;!

XML , 1.1.

1.1. XML

lt ""

amp&

apos'

quot"

, , . , < ( "") & () , .

> 5 ! " & ".

product > 5 ! " & ". Unicode, . . (, , ) ; ;, Unicode- . "-!" :41;438;440;443; - ! , "" unicode- , , "", . . , . :

, , URI ., animal.ent : , :

ent/animal animal.ent. , , www.animalhost.com,

, :

]>

&animal; > 5 ! !

product > 5 ! ! . , , , , , . , XML- , , . :

, animal

"http://www.animalhost.com/animal.ent"> XML-, -//ZOO//Elephant//Description , , animal.ent , . , , : ; XML- ; , , ; Unicode. . CharRef :[66] CharRef ::= '' [0-9]+ ';' | "' [0-9a-fA-F]+ ';'CharRef , . , 0 9, a, b, c, d, e, f . , 0020; , 20; . , , EntityRef:[68] EntityRef ::= '&' Name Reference:[67] Reference ::= EntityRef | CharRef , &; ;, , , . ; , &; . , . , ( ), . Reference "", , , . :[71] GEDecl ::= ''Name, , , a EntityDef, , . ( , EntityValue), ( , ExternalID NDataDecl?).[73] EntityDef ::= EntityValue | (ExternalID NDataDecl?)EntityValue , . EntityDef , , . : (. parsed entity) , XML; (. unparsed entity) -XML (, , ). NDataDecl .[76] NdataDecl ::= S 'NDATA' S Name -. DTD . - . - '%'. - , DTD. coords, :

-, sphere, x, y, z ( ) R (), :

, XML- x,y z X, Y Z, .- W3. XSLT , , -. - (, ) PEReference, EntityRef:[69] PEReference ::= '%' Name ';' - :[72] PEDecl ::= ''[74] PEDef::= EntityValue | ExternalID EntityDecl, , , -, :[70] EntityDecl ::= GEDecl | PEDecl, GEDecl , a PEDecl .

, XML- . . , , , . XML . , . , ., GIF, gif-viewer.exe. :

GIF , . - (. helper application) . , . , :

, :

. ENTITY ENTITIES, NOTATION , , . , ( 1.5). 1.5.

image ENTITY #REQUIREDtitle CDATA #REQUIRED href CDATA #REQUIRED>]>

. , menu. menuitem. menuitem . menuitem : image, ; title, ; href, . gif gif-viewer.exe. jpg jpg-viewer.exe. news, () gif. products, jpg. support, gif. , . menuitem:

title href : . image , . ENTITY, , , : , . , image . products, , jpg, prod.jpg jpg-viewer.exe. . ( ) NOTATION. , . 1.6.

type NOTATION (rtf|htm|txt) #REQUIRED>]>

... ... ]]>

, : rtf, htm txt. type root , "htm" (, , HTML-). , , , . , , .

XML- , . , , . , . , , CP-866, KOI8-R, CP-1251, ISO-8859-5, Macintosh , , -. , , , , , . , Unicode. Unicode , , , . Unicode #x400 #x4ff. PDF Web- Unicode:http://www.unicode.org/charts/PDF/U0400.pdf.

Unicode , (, ) Unicode UTF-8, UTF-16 UTF-32.UTF-8 UTF-8 , . #x0#x7F , . . . . . 1.2 , , , .

1.2. UTF-8- -

#x0-#x7F10xxxxxxx7

#x80-#x7FF2110xxxxx 10xxxxxx11

#x800-#xFFFF31110xxxx 10xxxxxx 10xxxxxx16

#x10000- #x1FFFFF411110xxx 10xxxxxx 10xxxxxx 10xxxxxx21

, "" ( "") Unicode #x42D 10000101101 . #x80-#x7ff, , - 110xxxxx 10xxxxxx, "x" 11 , . , :1101000010101101 #xD0AD . UTF-8 (110 , , 10 ), . UTF-8 , 127 7- ASCII. UTF-8, .UTF-16 , #xFFFF, UTF-16 , . , UTF-16 #10000-#FFFFF. UTF-16 16- #xD800-#xDFFF ( Unicode), (surrogate pairs). 10 , 20 , , #xFFFFF (. 1.3).

1.3. UTF-16- -

#x0-#xD7FF2xxxxxxxx xxxxxxxx16

#xD800-#xDFFF

#xE000-#xFFFF2xxxxxxxx xxxxxxxx16

#x10000-#xFFFFF4110110xxxxxxxxxx 110110xxxxxxxxxx20

"" #x42D UTF-16 #x042D. #x153DC ( 10101001111011100) 4 . 11011000010101001101101111011100 #xD854DBDC . UTF-16, .UTF-32UTF-32 , , 4 . , , , , .

Unicode Unicode , , , (no-break space), , . , XML-, . 1.4.

1.4. Unicode-

#9[] (horizontal tabulation)

#xA[LF] (line feed)

#xD[CR] (carriage return)

#x20[SP] (space)

#x21! (exclamation sign)

#x22" (quotation mark)

#x26& (ampersand)

#x27' (apostrophe)

#x3C


Recommended