fishScript.com d
Home| Progetto| Web| Faq| Acronimi

Argomenti

Documenti pubblicabili:1120
Scripts:1282
Documenti non pubblicabili:162
Categorie tematiche:68
.Net
   |_C#
   |_Visual basic.net
   |_Asp.net
Active Server Pages
C++
Cascade Style Sheet
JavaScript
Mysql
Php
Xml
Java
   |_Java 2 Micro Edition
   |_Java server pages
   |_Java Servlet
Oracle
   |_PLSQL
PostgreSQL
Unix


Oracle... Script: dbms_output.put_line



PLSQL... Script: TYPE TABLE
Shell scripting... Script: while do loop

Basically, a web session can be defined as the timeframe in which a visitor navigates your web site.



XPath is a language for addressing parts of an XML document. It is designed to be used by XSLT and XPointer.

Basically, a web session can be defined as the timeframe in which a visitor navigates your web site.

Documents

Home >Xml > How does XSLT transform XML?

Stampa  Stampa


By now you are probably wondering exactly how XSLT goes about processing an XML document in order to convert it into the required output. There are usually two aspects to this process:

The first stage is a structural transformation, in which the data is converted from the structure of the incoming XML document to a structure that reflects the desired output.
The second stage is formatting, in which the new structure is output in the required format such as HTML or PDF.
The second stage covers the ground we discussed in the previous section: the data structure that results from the first stage can be output as HTML, a text file or as XML. HTML output allows the information to be viewed directly in a browser by a human user or be input into any modern word processor. Plain text output allows data to be formatted in the way an existing application can accept, for example comma-separated values or one of the many text-based data interchange formats that were developed before XML arrived on the scene. Finally, XML output allows the data to be supplied to one of the new breed of applications that accepts XML directly. Typically this will use a different vocabulary of XML tags from the original document: for example an XSLT transformation might take the monthly sales figures as its XML input and produce a histogram as its XML output, using the XML-based SVG standard for vector graphics. Or you could use an XSLT transformation to generate VOXML output, for aural rendition of your data.

Let's now delve into the first stage, transformation - the stage with which XSLT is primarily concerned and which makes it possible to provide output in all of these formats. This stage might involve selecting data, aggregating and grouping it, sorting it, or performing arithmetic conversions such as changing centimeters to inches.

So how does this come about? Before the advent of XSLT, you could only process incoming XML documents by writing a custom application. The application wouldn't actually need to parse the raw XML, but it would need to invoke an XML parser, via a defined Application Programing Interface (API), to get information from the document and do something with it. There are two principal APIs for achieving this: the Simple API for XML (SAX) and the Document Object Model (DOM).

The SAX API is an event-based interface in which the parser notifies the application of each piece of information in the document as it is read. If you use the DOM API, then the parser interrogates the document and builds a tree-like object structure in memory. You would then write a custom application (in a procedural language such as C++, Visual Basic, or Java, for example), which could interrogate this tree structure. It would do so by defining a specific sequence of steps to be followed in order to produce the required output. Thus, whatever parser you use, this process has the same principal drawback: every time you want to handle a new kind of XML document, you have to write a new custom program, describing a different sequence of steps, to process the XML.

Both the DOM and the SAX APIs are fully described in the Wrox Press book Professional XML, ISBN 1-861003-11-0.

So how is using XSLT to perform transformations on XML better than writing "custom applications"? Well, the design of XSLT is based on a recognition that these programs are all very similar, and it should therefore be possible to describe what they do using a high-level declarative language rather than writing each program from scratch in C++, Visual Basic, or Java. The required transformation can be expressed as a set of rules. These rules are based on defining what output should be generated when particular patterns occur in the input. The language is declarative, in the sense that you describe the transformation you require, rather than providing a sequence of procedural instructions to achieve it. XSLT describes the required transformation and then relies on the XSL processor to decide the most efficient way to go about it.

XSLT still relies on a parser – be it a DOM parser or a SAX-compliant one – to convert the XML document in to a "tree structure". It is the structure of this tree representation of the document that XSLT manipulates, not the document itself. If you are familiar with the DOM, then you will be happy with the idea of treating every item in an XML document (elements, attributes, processing instructions etc.) as a node. With XSLT we have a high-level language that can navigate around a node tree, select specific nodes and perform complex manipulations on these nodes.

The XSLT tree model is similar in concept to the DOM but it is not the same. The full XSLT processing model is discussed in Chapter 2.

The description of XSLT given thus far (a declarative language that can navigate to and select specific data and then manipulate that data) may strike you as being similar to that of the standard database query language: SQL.



Warning: include(ads/text468x15.html): failed to open stream: No such file or directory in D:\inetpub\webs\fishscriptcom\documents\view_document.php on line 131

Warning: include(): Failed opening 'ads/text468x15.html' for inclusion (include_path='.;C:\php\pear') in D:\inetpub\webs\fishscriptcom\documents\view_document.php on line 131

Tutorial
Iniziare con Xml Oggetti e metodi per la gestione dei documenti Xml con Javascript e ActiveX   [Xml] 
Script
Parsing file Xml Acquisizione e stampa dei dati di un file Xml  [Xml] 
Lettura dei childNodes di un file xml Lettura da xml dei campi del primo elemento disposti in un array  [Xml] 
Semplice esempio xslt/ xml Utilizzo di xslt  [Xml] 
Le 4 fasi di caricamento e parsing di un documento Xml Attraverso un esempio vengono rpese in esame le fasi di caricamento e di validazione utilizzando l'oggetto ActiveXObjectMsxml2.DOMDocument   [Xml] 
Importazione di file xml Stampa di tutti i campi(childNodes) del primo elemento  [Xml] 
Importazione file xml (variante) Stampa di alcuni campi(childNodes) del primo elemento  [Xml] 
Leggere i dati da file Esempio di lettura dati da formati Xml, Html, Txt  [Xml] 
Stampa nodi figli e valori utilizzo metodo documentElement  [Xml] 
Parsing file xml Stampa di tutti i campi(childNodes) del primo elemento  [Xml] 
Interrogare xml attraverso Xsl formattazione e conteggio dei dati   [Xml] 
Esempio Xsl e Xml File xls che estrae e formatta i dati di un file xml  [Xml] 
Template XHTML 1.0 Modello file XHTML   [Xml] 
XHTML 1.0 Strict template Un'altro template Xhtml pronto all'utilizzo con l'impostazione della pagina con <thead>,<tfoot>,<tbody> come raccomandato dal W3c  [Xml] 
Entità e caratteri speciali Gestione dei caratteri speciali attraverso xsl  [Xml] 
Strutture condizionali in xsl costrutti choose, when e otherwise  [Xml] 

signal Marco Magnani marcomagnani@fishscript.com



Cerca





A good scientist is a person with original ideas.
A good engineer is a person who makes a design that works with as few original ideas as possible. There are no prima donnas in engineering.
Freeman Dyson


A good scientist is a person with original ideas.
A good engineer is a person who makes a design that works with as few original ideas as possible. There are no prima donnas in engineering.
Freeman Dyson



Xml... Definizioni: XSLT

Oracle... Definizioni: Variabile bind





fishScript.Com is accessible by Mobile access technology as mobile phones, Palm and Pocket PC .

Nicoleta e Marco Magnani tutorial, examples, courses, esempi, corsi, esercizi, appunti vari Dottoressa Nicoleta Dragu Formatrice Docente Insegnante Mediatrice Culturale Dott. Marco Magnani Universita La Sapienza Roma Master Computer Science Hunter College New York , Data Base Administrator DBA oracle System architect

Last modified: 2017-11-30 amministratore@fishscript.comNico and Marco Magnani Software Production
Home|About this Site © 2003-2008 www.fishScript.com ®