• Data-Driven Model
  • XSL Stylesheets Are XML Documents By default, they all begin with the XML declaration: XSL Stylesheets Are Self-Declarative
  • Microsoft Word Applied xml a toolkit for Programmers Wiley doc




    Download 2,96 Mb.
    Pdf ko'rish
    bet129/131
    Sana14.05.2024
    Hajmi2,96 Mb.
    #232039
    1   ...   123   124   125   126   127   128   129   130   131
    Bog'liq
    Ceponkus, Hoodbhoy - Applied XML - Toolkit for Programmers

    Template-Driven Model
    If the XML data source consists of repetitive structures that require similar transformation 
    or formatting, then the 
    template-driven model
    is used. This model would be used when 
    representing relational data (that is, table-based data). An example would be an XML 
    contact data set where a repetitive structure (contact, name, address, telephone) is used 
    for representing information. You could think in terms of applying XSL as a mail merge 
    utility in this case, for formatting mail labels for printing from a contact database.
    Data-Driven Model
    If the XML data source consists of irregular data, then a 
    data-driven model 
    is used. By 
    irregular we mean nonrepetitive; for example, a document structure. Think of a letter 
    consisting of various sections such as to, from, date, greeting, introduction, body, 
    conclusion, and signature. Each section is generally used only once and may need to be 
    treated separately for proper formatting. In the data-driven model, template fragments are 
    defined and used to treat each section separately. The XSL processor combines the 
    results of all the template fragments and spits out a complete resultant tree.
    As you would expect, you can mix and match these models. For example, you could 
    perform an actual mail merge where the contents of the letter are treated on a data-driven 
    model and the “to” section is treated as a template driven model.
    XSL Basics
    A few XSL basics are common to all XSL stylesheets.


    - 252 -
    XSL Stylesheets Are XML Documents
    By default, they all begin with the XML declaration:

    XSL Stylesheets Are Self-Declarative
    All XSL stylesheets declare themselves to be stylesheets; all XSL tags utilize the concept 
    of namespaces described in 
    Chapter 3
    , whereby every tag is preceded by the 
    namespace declaration, xsl:. When creating an XSL stylesheet, generally, the first line 
    that follows the XML declaration is the stylesheet declaration that includes the XSL 
    namespace declaration:

    Remember, that because this is an XML document, the xsl:stylesheet tag must be closed 
    at the end of the document. This means that the last line of your stylesheet generally is 
    as follows: 

    We are big believers in the inductive method of learning as opposed to the deductive 
    method of learning. We feel it is easier to learn by looking at what someone has done and 
    then experimenting with it yourself. Therefore, throughout the rest of this chapter, we go 
    through example applications of the XSL syntax. We close the chapter with a reference 
    section on the important XSL tags available for you to use.

    Download 2,96 Mb.
    1   ...   123   124   125   126   127   128   129   130   131




    Download 2,96 Mb.
    Pdf ko'rish

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    Microsoft Word Applied xml a toolkit for Programmers Wiley doc

    Download 2,96 Mb.
    Pdf ko'rish