For the Apply.jsp coming with Jakarta's XSL Taglib as an example, let's take a look at the relationship between JSP XML XSLT: Apply.jsp
<% @ Taglib Uri = "xsl.jar" prefix = "xsl"%>
Employee list title> head>
below The four combinations of JSP XML XSLT:
Using the Apply method below, combine the existing Employees.xml and Employeelist.xsl
below is to write XML data directly using already existing Employeelist.xs, then yourself in JSP. < XML Version = "1.0" encoding = "ISO-8859-1"?> john first-name> doe last -Name> 800-555-1212 telephone> employee> George first-name> Taylor last-name> < TELEPHONE> 555-555-1212 telephone> EMPLOYEE> Employees> xsl: apply>
The following to the use of include, such an XSLT style can accommodate different XML files.
xsl: apply>
below is using the Import method, Page-scope Import XML file p> body> In the above program, four JSP combined XML XSLT methods can basically meet our needs. Note The above XML file path is "/ xml /", which is an absolute path to the Tomcat container.
Let's take a look at Employeelist.xsl and Employees.xml content:
EmployeeList.xsl is similar to CSS in HTML, mainly to define data display mode in XML:
XML Version = "1.0"?>
Id th>
Employee Name TH>
Phone Number th> TR>
td>
, td>
td> tr> xsl: For-Each> table> xsl: test> xsl: stylesheet> Employees.xml XML Version = "1.0" encoding = "ISO-8859-1"> Jane first-name> smith last-name> 888-555-1212 telephone> employee>
Use the browser that supports XML IE 5.0 or above, the display page is the same as the Apply.jsp display page.