Academic Tutorials



English | French | Portugese | Dutch | Italian
Google

em linha

Home C�digos de fonte E-Livros Downloads Contatar-nos Sobre n�s

HTML Tutorials
HTML Tutorial
XHTML Tutorial
CSS Tutorial
TCP/IP Tutorial
CSS 1.0
CSS 2.0
HLML
XML Tutorials
XML Tutorial
XSL Tutorial
XSLT Tutorial
DTD Tutorial
Schema Tutorial
XForms Tutorial
XSL-FO Tutorial
XML DOM Tutorial
XLink Tutorial
XQuery Tutorial
XPath Tutorial
XPointer Tutorial
RDF Tutorial
SOAP Tutorial
WSDL Tutorial
RSS Tutorial
WAP Tutorial
Web Services Tutorial
Browser Scripting
JavaScript Tutorial
VBScript Tutorial
DHTML Tutorial
HTML DOM Tutorial
WMLScript Tutorial
E4X Tutorial
Server Scripting
ASP Tutorial
PERL Tutorial
SQL Tutorial
ADO Tutorial
CVS
Python
Apple Script
PL/SQL Tutorial
SQL Server
PHP
.NET (dotnet)
Microsoft.Net
ASP.Net
.Net Mobile
C# : C Sharp
ADO.NET
VB.NET
VC++
Multimedia
SVG Tutorial
Flash Tutorial
Media Tutorial
SMIL Tutorial
Photoshop Tutorial
Gimp Tutorial
Matlab
Gnuplot Programming
GIF Animation Tutorial
Scientific Visualization Tutorial
Graphics
Web Building
Web Browsers
Web Hosting
W3C Tutorial
Web Building
Web Quality
Web Semantic
Web Careers
Weblogic Tutorial
SEO
Web Site Hosting
Domain Name
Java Tutorials
Java Tutorial
JSP Tutorial
Servlets Tutorial
Struts Tutorial
EJB Tutorial
JMS Tutorial
JMX Tutorial
Eclipse
J2ME
JBOSS
Programming Langauges
C Tutorial
C++ Tutorial
Visual Basic Tutorial
Data Structures Using C
Cobol
Assembly Language
Mainframe
Forth Programming
Lisp Programming
Pascal
Delphi
Fortran
OOPs
Data Warehousing
CGI Programming
Emacs Tutorial
Gnome
ILU
Soft Skills
Communication Skills
Time Management
Project Management
Team Work
Leadership Skills
Corporate Communication
Negotiation Skills
Database Tutorials
Oracle
MySQL
Operating System
BSD
Symbian
Unix
Internet
IP-Masquerading
IPC
MIDI
Software Testing
Testing
Firewalls
SAP Module
ERP
ABAP
Business Warehousing
SAP Basis
Material Management
Sales & Distribution
Human Resource
Netweaver
Customer Relationship Management
Production and Planning
Networking Programming
Corba Tutorial
Networking Tutorial
Microsoft Office
Microsoft Word
Microsoft Outlook
Microsoft PowerPoint
Microsoft Publisher
Microsoft Excel
Microsoft Front Page
Microsoft InfoPath
Microsoft Access
Accounting
Financial Accounting
Managerial Accounting


XSLT transformam

Next Next





Transforma��o de XSL
Vista geral:

O diagrama representa o processo da transforma��o: recolhendo um original de XML, aplicando a lima de XSLT aos n�s do original de XML, e gerar um outro original do formato desejado.



Consiste em duas fun��es. A primeira fun��o l� simplesmente um original de XML e transforma ent�o os dados usando uma lima de XSLT. A segunda fun��o l� um original de XML, transforma os dados, e escreve ent�o um original novo de XML dos dados transformados.




Exemplo 1: - XML de transforma��o a XML
Transformando o original de XML

<?xml version="1.0"?>
<persons>
  <person username="MP123456">
    <name>John</name>
    <family_name>Smith</family_name>
  </person>
  <person username="PK123456">
    <name>Morka</name>
    <family_name>Ismincius</family_name>
  </person>
</persons>


Aplicando-se os XSLT transformam:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<transform>
<xsl:apply-templates/>
</transform>
</xsl:template>
<xsl:template match="person">
<record>
<username>
<xsl:value-of select="@username" />
</username>
<name>
<xsl:value-of select="name" />
</name>
</record>
</xsl:template>
</xsl:stylesheet>
 


Resultados em um original novo de XML, tendo uma outra estrutura:

<?xml version="1.0" encoding="UTF-8"?>
<transform>
   <record>
      <username>MP123456</username>
      <name>John</name>
   </record>
   <record>
      <username>PK123456</username>
      <name>Morka</name>
   </record> 
</transform>
 




Exemplo 2: XML de transforma��o a XHTML
Exemplo do original entrante de XML:

<?xml version="1.0" encoding="UTF-8"?>

<domains>
<sun.com ownedBy="Sun Microsystems Inc.">
<host>
www
<use>World Wide Web site</use>
</host>
<host>
java
<use>Java info</use>
</host>
</sun.com>

<w3.org ownedBy="The World Wide Web Consortium">
<host>
www
<use>World Wide Web site</use>
</host>
<host>
validator
<use>web developers who want to get it right</use>
</host>
</w3.org>
</domains>
 


Exemplo XSLT Stylesheet:

<?xml version="1.0" encoding="UTF-8" ?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml">
<xsl:output method="xml" indent="yes"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>

<!--XHTML document outline-->
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>test1</title>
<style type="text/css">
h1 { padding: 10px; padding-width: 100%; background-color: silver }
td, th { width: 40%; border: 1px solid silver; padding: 10px }
td:first-child, th:first-child { width: 20% }
table { width: 650px }
</style>
</head>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>

<!--Table headers and outline-->
<xsl:template match="domains/*">
<h1><xsl:value-of select="@ownedBy"/></h1>
<p>The following host names are currently in use at
<strong><xsl:value-of select="local-name(.)"/></strong>
</p>
<table>
<tr><th>Host name</th><th>URL</th><th>Used by</th></tr>
<xsl:apply-templates/>
</table>
</xsl:template>

<!--Table row and first two columns-->
<xsl:template match="host">
<!--Create variable for 'url', as it's used twice-->
<xsl:variable name="url" select=
"normalize-space(concat('http://', normalize-space(node()), '.', local-name(..)))"/>
<tr>
<td><xsl:value-of select="node()"/></td>
<td><a href="{$url}"><xsl:value-of select="$url"/></a></td>
<xsl:apply-templates select="use"/>
</tr>
</xsl:template>

<!--'Used by' column-->
<xsl:template match="use">
<td><xsl:value-of select="."/></td>
</xsl:template>

</xsl:stylesheet>


XHTML output que isto produziria

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
  <head>
    <meta content="text/html;charset=UTF-8" http-equiv="Content-Type" />
    <title>test1</title>
    <style type="text/css">
      h1          { padding: 10px; padding-width: 100%; background-color: silver }
      td, th      { width: 40%; border: 1px solid silver; padding: 10px }
      td:first-child, th:first-child  { width: 20% }
      table       { width: 650px }
    </style>
  </head>
  <body>
    <h1>Sun Microsystems Inc.</h1>
    <p>The following host names are currently in use at <strong>sun.com</strong></p>
    <table>
        <tr>
          <th>Host name</th>
          <th>URL</th>
          <th>Used by</th>
        </tr>
        <tr>
          <td>www</td>
          <td><a href="http://www.sun.com">http://www.sun.com</a></td>
          <td>World Wide Web site</td>
        </tr>
        <tr>
          <td>java</td>
          <td><a href="http://java.sun.com">http://java.sun.com</a></td>
          <td>Java info</td>
        </tr>
    </table>
   
    <h1>The World Wide Web Consortium</h1>
    <p>The following host names are currently in use at <strong>w3.org</strong></p>
    <table>
      <tr>
        <th>Host name</th>
        <th>URL</th>
        <th>Used by</th>
      </tr>
      <tr>
        <td>www</td>
        <td><a href="http://www.w3.org">http://www.w3.org</a></td>
        <td>World Wide Web site</td>
      </tr>
      <tr>
        <td>validator</td>
        <td><a href="http://validator.w3.org">http://validator.w3.org</a></td>
        <td>web developers who want to get it right</td>
      </tr>
    </table>
  </body>
</html>
 





Next Next

Keywords xslt transform, xsl transform, xslt transform xml, xml xsl transform, xalan transform, xsl transforms, c# xsl transform, net xsl transform, xslt transforms, javascript xsl transform, transform xml with xsl, java xsl transform, transform xml using xslt, net xslt transform, java xslt transform, xsl identity transform, xslt for each, asp net xslt, asp net transform, xslt transformation.



HTML Quizes
HTML Quiz
XHTML Quiz
CSS Quiz
TCP/IP Quiz
CSS 1.0 Quiz
CSS 2.0 Quiz
HLML Quiz
XML Quizes
XML Quiz
XSL Quiz
XSLT Quiz
DTD Quiz
Schema Quiz
XForms Quiz
XSL-FO Quiz
XML DOM Quiz
XLink Quiz
XQuery Quiz
XPath Quiz
XPointer Quiz
RDF Quiz
SOAP Quiz
WSDL Quiz
RSS Quiz
WAP Quiz
Web Services Quiz
Browser Scripting Quizes
JavaScript Quiz
VBScript Quiz
DHTML Quiz
HTML DOM Quiz
WMLScript Quiz
E4X Quiz
Server Scripting Quizes
ASP Quiz
PERL Quiz
SQL Quiz
ADO Quiz
CVS Quiz
Python Quiz
Apple Script Quiz
PL/SQL Quiz
SQL Server Quiz
PHP Quiz
.NET (dotnet) Quizes
Microsoft.Net Quiz
ASP.Net Quiz
.Net Mobile Quiz
C# : C Sharp Quiz
ADO.NET Quiz
VB.NET Quiz
VC++ Quiz
Multimedia Quizes
SVG Quiz
Flash Quiz
Media Quiz
SMIL Quiz
Photoshop Quiz
Gimp Quiz
Matlab Quiz
Gnuplot Programming Quiz
GIF Animation Quiz
Scientific Visualization Quiz
Graphics Quiz
Web Building  Quizes
Web Browsers Quiz
Web Hosting Quiz
W3C Quiz
Web Building Quiz
Web Quality Quiz
Web Semantic Quiz
Web Careers Quiz
Weblogic Quiz
SEO Quiz
Web Site Hosting Quiz
Domain Name Quiz
Java Quizes
Java Quiz
JSP Quiz
Servlets Quiz
Struts Quiz
EJB Quiz
JMS Quiz
JMX Quiz
Eclipse Quiz
J2ME Quiz
JBOSS Quiz
Programming Langauges Quizes
C Quiz
C++ Quiz
Visual Basic Quiz
Data Structures Using C Quiz
Cobol Quiz
Assembly Language Quiz
Mainframe Quiz
Forth Programming Quiz
Lisp Programming Quiz
Pascal Quiz
Delphi Quiz
Fortran Quiz
OOPs Quiz
Data Warehousing Quiz
CGI Programming Quiz
Emacs Quiz
Gnome Quiz
ILU Quiz
Soft Skills Quizes
Communication Skills Quiz
Time Management Quiz
Project Management Quiz
Team Work Quiz
Leadership Skills Quiz
Corporate Communication Quiz
Negotiation Skills Quiz
Database Quizes
Oracle Quiz
MySQL Quiz
Operating System Quizes
BSD Quiz
Symbian Quiz
Unix Quiz
Internet Quiz
IP-Masquerading Quiz
IPC Quiz
MIDI Quiz
Software Testing Quizes
Testing Quiz
Firewalls Quiz
SAP Module Quizes
ERP Quiz
ABAP Quiz
Business Warehousing Quiz
SAP Basis Quiz
Material Management Quiz
Sales & Distribution Quiz
Human Resource Quiz
Netweaver Quiz
Customer Relationship Management Quiz
Production and Planning Quiz
Networking Programming Quizes
Corba Quiz
Networking Quiz
Microsoft Office Quizes
Microsoft Word Quiz
Microsoft Outlook Quiz
Microsoft PowerPoint Quiz
Microsoft Publisher Quiz
Microsoft Excel Quiz
Microsoft Front Page Quiz
Microsoft InfoPath Quiz
Microsoft Access Quiz
Accounting Quizes
Financial Accounting Quiz
Managerial Accounting Quiz

Privacy Policy
Copyright � 2003-2024 Vyom Technosoft Pvt. Ltd., All Rights Reserved.