Academic Tutorials



English | French | Portugese | Dutch | Italian
Google

Online

� la maison Codes sources E-Livres T�l�chargements Nous contacter Au sujet de nous

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


Variables de XSL

Previous Next





Pla�ant le XSl variable

le stylesheet 1 et le stylesheet 3 montre les diff�rentes mani�res de placer un xsl : variable, stylesheet 2 de XSLT et stylesheet 4 de XSLT de placer le xsl : param.



XML Source

<source>
<chapter>Chapter A</chapter>
<chapter>Chapter B</chapter>
<chapter>Chapter C</chapter>
<chapter>Chapter D</chapter>
</source>


Output 1

<TABLE>
<TR>
<TD>Chapter A (1/4)</TD>
</TR>
<TR>
<TD>Chapter B (2/4)</TD>
</TR>
<TR>
<TD>Chapter C (3/4)</TD>
</TR>
<TR>
<TD>Chapter D (4/4)</TD>
</TR>
</TABLE>


XSL stylesheet 1

<xsl:stylesheet version = '1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:variable name="totalChapters">
<xsl:value-of select="count(//chapter)"/>
</xsl:variable>
<xsl:template match="/">
<TABLE>
<xsl:for-each select="//chapter">
<TR>
<TD>
<xsl:value-of select="."/>
<xsl:text> (</xsl:text>
<xsl:value-of select="position()"/>
<xsl:text>/</xsl:text>
<xsl:value-of select="$totalChapters"/>
<xsl:text>)</xsl:text>
</TD>
</TR>
</xsl:for-each>
</TABLE>
</xsl:template>
</xsl:stylesheet>





XML Source

<source>
<chapter>Chapter A</chapter>
<chapter>Chapter B</chapter>
<chapter>Chapter C</chapter>
<chapter>Chapter D</chapter>
</source>


Output 2

<TABLE>
<TR>
<TD>Chapter A (1/4)</TD>
</TR>
<TR>
<TD>Chapter B (2/4)</TD>
</TR>
<TR>
<TD>Chapter C (3/4)</TD>
</TR>
<TR>
<TD>Chapter D (4/4)</TD>
</TR>
</TABLE>


XSL stylesheet 2

<xsl:stylesheet version = '1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:param name="totalChapters">
<xsl:value-of select="count(//chapter)"/>
</xsl:param>
<xsl:template match="/">
<TABLE>
<xsl:for-each select="//chapter">
<TR>
<TD>
<xsl:value-of select="."/>
<xsl:text> (</xsl:text>
<xsl:value-of select="position()"/>
<xsl:text>/</xsl:text>
<xsl:value-of select="$totalChapters"/>
<xsl:text>)</xsl:text>
</TD>
</TR>
</xsl:for-each>
</TABLE>
</xsl:template>
</xsl:stylesheet>





XML Source

<source>
<chapter>Chapter A</chapter>
<chapter>Chapter B</chapter>
<chapter>Chapter C</chapter>
<chapter>Chapter D</chapter>
</source>


Output 3

<TABLE>
<TR>
<TD>Chapter A (1/4)</TD>
</TR>
<TR>
<TD>Chapter B (2/4)</TD>
</TR>
<TR>
<TD>Chapter C (3/4)</TD>
</TR>
<TR>
<TD>Chapter D (4/4)</TD>
</TR>
</TABLE>


XSL stylesheet 3

<xsl:stylesheet version = '1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:variable name="totalChapters" select="count(//chapter)"/>
<xsl:template match="/">
<TABLE>
<xsl:for-each select="//chapter">
<TR> <TD>
<xsl:value-of select="."/>
<xsl:text> (</xsl:text>
<xsl:value-of select="position()"/>
<xsl:text>/</xsl:text>
<xsl:value-of select="$totalChapters"/>
<xsl:text>)</xsl:text>
</TD>
</TR>
</xsl:for-each>
</TABLE>
</xsl:template>
</xsl:stylesheet>





XML Source

<source>

<chapter>Chapter A</chapter>
<chapter>Chapter B</chapter>
<chapter>Chapter C</chapter>
<chapter>Chapter D</chapter>
</source>


OutPut 4

<TABLE>
<TR>
<TD>Chapter A (1/4)</TD>
</TR>
<TR>
<TD>Chapter B (2/4)</TD>
</TR>
<TR>
<TD>Chapter C (3/4)</TD>
</TR>
<TR>
<TD>Chapter D (4/4)</TD>
</TR>
</TABLE>


XSL stylesheet 4

<xsl:stylesheet version = '1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:param name="totalChapters" select="count(//chapter)"/>
<xsl:template match="/">
<TABLE>
<xsl:for-each select="//chapter">
<TR>
<TD>
<xsl:value-of select="."/>
<xsl:text> (</xsl:text>
<xsl:value-of select="position()"/>
<xsl:text>/</xsl:text>
<xsl:value-of select="$totalChapters"/>
<xsl:text>)</xsl:text>
</TD>
</TR>
</xsl:for-each>
</TABLE>
</xsl:template>
</xsl:stylesheet>



Variables avec le m�me nom

Stylesheet peut faire ont plusieurs variables avec le m�me nom. Le stylesheet 1 de XSL d�montre comment r�cup�rer la valeur de la variable globale qui a le m�me nom que celui de le local. La valeur de la variable locale est li�e au xsl : quand �l�ment. Le reste du calibre voit donc seulement une variable globale.



XML Source

<source>
<chapter>Chapter A</chapter>
<chapter>Chapter B</chapter>
<chapter>Chapter C</chapter>
<chapter>Chapter D</chapter>
</source>


Output

<TABLE>
<TR>
<TD>First chapter : Chapter A</TD>
</TR>
<TR>
<TD>Chapter : Chapter B</TD>
</TR>
<TR>
<TD>Chapter : Chapter C</TD>
</TR>
<TR>
<TD>Last chapter : Chapter D</TD>
</TR>
</TABLE>


XSL stylesheet

<xsl:stylesheet version = '1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:variable name="text">Chapter</xsl:variable>
<xsl:template match="/">
<TABLE>
<xsl:for-each select="//chapter">
<TR>
<TD>
<xsl:variable name="text">
<xsl:choose>
<xsl:when test="position() = 1">First chapter</xsl:when>
<xsl:when test="position()=last()">Last chapter</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="$text"/>
<xsl:text> : </xsl:text>
<xsl:value-of select="."/>
</TD>
</TR>
</xsl:for-each>
</TABLE>
</xsl:template>
</xsl:stylesheet>



�l�ment d'Avec-Param de XSL

Des param�tres pour le calibre peuvent �tre pass�s avec un xsl : �l�ment d'avec-param. Si un calibre contient le xsl : �l�ment de param ayant le m�me nom que celui d'un attribut nomm� de xsl : l'avec-param, cette valeur est employ�. Le stylesheet 1 de XSL montre l'exemple typique. Si vous voulez passer la variable, vous devriez devoir d�finir cette variable avec le xsl : �l�ment de param. Regarder le stylesheet 2 de XSL pour l'approche fausse.



XML Source

<source>
<number>1</number>
<number>3</number>
<number>4</number>
<number>17</number>
<number>8</number>
</source>


Output

<TABLE>
<TR>
<TH>1 (odd)</TH>
</TR>
<TR>
<TH>3 (odd)</TH>
</TR>
<TR>
<TH>4 (even)</TH>
</TR>
<TR>
<TH>17 (odd)</TH>
</TR>
<TR>
<TH>8 (even)</TH>
</TR>
</TABLE>


XSL stylesheet 1

<xsl:stylesheet version = '1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:template match="/">
<TABLE>
<xsl:for-each select="//number">
<TR>
<TH>
<xsl:choose>
<xsl:when test="text() mod 2">
<xsl:apply-templates select=".">
<xsl:with-param name="type">odd</xsl:with-param>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="."/>
</xsl:otherwise>
</xsl:choose>
</TH>
</TR>
</xsl:for-each>
</TABLE>
</xsl:template>
<xsl:template match="number">
<xsl:param name="type">even</xsl:param>
<xsl:value-of select="."/>
<xsl:text> (</xsl:text>
<xsl:value-of select="$type"/>
<xsl:text>)</xsl:text>
</xsl:template>
</xsl:stylesheet>


XSL stylesheet 2



XSLT stylesheet

<xsl:stylesheet version = '1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:template match="/">
<TABLE>
<xsl:for-each select="//number">
<TR>
<TH>
<xsl:choose>
<xsl:when test="text() mod 2">
<xsl:apply-templates select=".">
<xsl:with-param name="type">odd</xsl:with-param>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="."/>
</xsl:otherwise>
</xsl:choose>
</TH>
</TR>
</xsl:for-each>
</TABLE>
</xsl:template>
<xsl:template match="number">
<xsl:variable name="type">even</xsl:variable>
<xsl:value-of select="."/>
<xsl:text> (</xsl:text>
<xsl:value-of select="$type"/>
<xsl:text>)</xsl:text>
</xsl:template>
</xsl:stylesheet>



r�glage du xsl : variable,

La variable peut tenir le fragment d'arbre de r�sultat. Les op�rations qui sont autoris�es sur le fragment d'arbre de r�sultat sont le sous-ensemble de ceux autoris�s sur noeud-ont plac�. L'op�ration est autoris�e sur le fragment d'arbre de r�sultat seulement si cette op�ration devrait �tre autoris�e sur la corde, op�ration sur la corde peut impliquer de convertir d'abord une corde en nombre ou bool�en. En particulier, elle n'est pas autoris�e pour employer � /, //, et [] � des op�rateurs sur les fragments d'arbre de r�sultat. Quand l'op�ration autoris�e est effectu�e sur le fragment d'arbre de r�sultat, elle est ex�cut�e exactement de la mani�re car elle serait sur un �quivalent noeud-a plac�.



XML Source

<source>
<TABLE border="1">
<TR>
<TD>AAA</TD>
<TD>BBB</TD>
</TR>
<TR>
<TD>aaa</TD>
<TD>bbb</TD>
</TR>
</TABLE>
<TABLE border="1">
<TR>
<TD>1111111</TD>
</TR>
<TR>
<TD>22222222</TD>
</TR>
</TABLE>
</source>


Output

<TABLE border="1">
<TR>
<TD>1111111</TD>
</TR>
<TR>
<TD>22222222</TD>
</TR>
</TABLE>
<TABLE border="1">
<TR>
<TD>AAA</TD>
<TD>BBB</TD>
</TR>
<TR>
<TD>aaa</TD>
<TD>bbb</TD>
</TR>
</TABLE>
<TABLE border="1">
<TR>
<TD>1111111</TD>
</TR>
<TR>
<TD>22222222</TD>
</TR>
</TABLE>


XSL stylesheet

<xsl:stylesheet version = '1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:variable name="A1">
<xsl:copy-of select="//TABLE[1]"/>
</xsl:variable>
<xsl:variable name="A2">
<xsl:copy-of select="//TABLE[2]"/>
</xsl:variable>
<xsl:template match="/">
<xsl:copy-of select="$A2"/> <xsl:copy-of select="$A1"/> <xsl:copy-of select="$A2"/>
</xsl:template>
</xsl:stylesheet>






Previous Next

Keywords XSL Variables, XSL Variables, xslt variables, xsl variable, xslt variable, xsl for each, xsl value of, asp net variables, asp net xsl, xpath variable, variables in xsl, variable in xslt, variables in xslt, variable in xsl, variables xsl, xsl variable scope, xsl set variable, xslt global variable, xsl variable value, xsl generate, xsl set, functions variables, convert xsl, date variables, xsl multiple, include variables, display variables, using variables, output variables, set variables, multiple variables, xsl call, xslt parameters, xml parameters, xsl parameters, xml variable, xml variables


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.