Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
xsl:for-each Element with filtering in XSLT
WhatsApp
Vijai Anand Ramalingam
12y
22.6
k
0
0
25
Blog
<xsl:for-each>
Element with filtering conditions:
Employees.xml:
<?
xml
version
=
"
1.0
"
encoding
=
"
utf-8
"
?>
<
Employees
>
<
Employee
>
<
Name
>
Vijai
</
Name
>
<
Id
>
1
</
Id
>
<
Designation
>
Associate
</
Designation
>
<
Location
>
Bangalore
</
Location
>
<
Department
>
SharePoint
</
Department
>
<
Experience
>
3
</
Experience
>
</
Employee
>
<
Employee
>
<
Name
>
Ranjith
</
Name
>
<
Id
>
2
</
Id
>
<
Designation
>
Associate
</
Designation
>
<
Location
>
Bangalore
</
Location
>
<
Department
>
SharePoint
</
Department
>
<
Experience
>
5
</
Experience
>
</
Employee
>
<
Employee
>
<
Name
>
Rakesh
</
Name
>
<
Id
>
3
</
Id
>
<
Designation
>
Associate
</
Designation
>
<
Location
>
Chennai
</
Location
>
<
Department
>
LN
</
Department
>
<
Experience
>
6
</
Experience
>
</
Employee
>
<
Employee
>
<
Name
>
Kavya
</
Name
>
<
Id
>
4
</
Id
>
<
Designation
>
Associate
</
Designation
>
<
Location
>
Chennai
</
Location
>
<
Department
>
LN
</
Department
>
<
Experience
>
3
</
Experience
>
</
Employee
>
<
Employee
>
<
Name
>
Pai
</
Name
>
<
Id
>
5
</
Id
>
<
Designation
>
Associate
</
Designation
>
<
Location
>
Chennai
</
Location
>
<
Department
>
LN
</
Department
>
<
Experience
>
3
</
Experience
>
</
Employee
>
</
Employees
>
EmployeesXSL.xsl:
<?
xml
version
=
"
1.0
"
encoding
=
"
utf-8
"
?>
<
xsl:stylesheet
version
=
"
1.0
"
xmlns:xsl
=
"
http://www.w3.org/1999/XSL/Transform
"
>
<
xsl:template
match
=
"
/
"
>
<
html
>
<
body
>
<
h3
Style
=
"
font-weight:bold; color:Green;font-style:italic
"
>
Employees
</
h3
>
<
table
border
=
"
1
"
>
<
tr
bgcolor
=
"
#CCCCFF
"
>
<
th
>
Name
</
th
>
<
th
>
Id
</
th
>
<
th
>
Department
</
th
>
<
th
>
Designation
</
th
>
<
th
>
Location
</
th
>
<
th
>
Experience
</
th
>
</
tr
>
<
xsl:for-each
select
=
"
Employees/Employee[Experience
>
3]
"
>
<
tr
STYLE
=
"
font-weight:normal; color:blue;font-style:italic
"
>
<
td
>
<
xsl:value-of
select
=
"
Name
"
/>
</
td
>
<
td
>
<
xsl:value-of
select
=
"
Id
"
/>
</
td
>
<
td
>
<
xsl:value-of
select
=
"
Department
"
/>
</
td
>
<
td
>
<
xsl:value-of
select
=
"
Designation
"
/>
</
td
>
<
td
>
<
xsl:value-of
select
=
"
Location
"
/>
</
td
>
<
td
>
<
xsl:value-of
select
=
"
Experience
"
/>
</
td
>
</
tr
>
</
xsl:for-each
>
</
table
>
</
body
>
</
html
>
</
xsl:template
>
</
xsl:stylesheet
>
Output:
Up Next
select query on datatable for filter data
Ebook Download
View all
.NET Interview Questions and Answer: Practical Implementation
Read by 41.8k people
Download Now!
Learn
View all
Membership not found