JSP XML and XSLT transform : XML « JSP « Java

JSP XML and XSLT transform



<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:param name="ageParam">60</xsl:param>

  <xsl:template match="people">
    <h1>List of people in the XML document</h1>
    <table border="1">
      <xsl:apply-templates />

  <xsl:template match="person">
    <xsl:call-template name="processPerson">
      <xsl:with-param name="ageParam">

  <xsl:template name="processPerson">
    <!-- <xsl:param name="ageParam" /> -->

        <xsl:value-of select="name/text()" />
        <xsl:value-of select="age/text()"  />
        <xsl:if test="age/text() > $ageParam">


<%@ taglib uri="http://java.sun.com/jstl/xml"  prefix="x" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>

<html >
    <title>Using a Named Template with Global Parameters</title>

    <c:import url="http://localhost:8080/chapter02/people.xml"
              var="inputDoc" />

    <c:import url="http://localhost:8080/chapter02/globalParam.xsl"
              var="stylesheet" />

    <x:transform xml  = "${inputDoc}"
                 xslt = "${stylesheet}">
      <x:param name="ageParam"  value="49" />


Related examples in the same category

1.Using the Core XML tags
2.XML transformation
3.Performing XSL Transformations
4.JSP in pure XML generating conforming XHTML
6.XSLT in JSP 2
7.JSP Parsing using the DOM
8.JSP Parsing using JDOM
9.JSP Parsing using the DOM and JSTL
10.JSP and SAX
11.JSP Displaying a Subset in XML
12.JSP List of data in the XML document
13.Deal With XML In JSP