Home Jstl Use of tag of JSTL



Use of tag of JSTL
Posted on: August 27, 2008 at 12:00 AM
In this section we will learn how to use tag of Xml tag library of Jstl.

Use of <x:param> tag of JSTL

     

In this section we will learn how to use <x:param> tag of  Xml tag library of Jstl. This tag is used to add parameter to transform tag. When user want to transform more than one xml files then we will use <x:param> tag, to add xml files in transform tag.

In the code given below we have used doc1, doc2, doc3 as xml source files and use param tag to add these files as parameter to transform tag.

 

 

 

 

 

Standard Syntax : <%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>

 Attributes: 
name  It defines name of the transformation parameter.
value  value of the transformation parameter.

param_xmlJstlTag.jsp

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 
<%@ taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x" %> 
<c:set var="doc1">
<document>
<description>This is first document.</description>
</document>
</c:set> 
<x:parse varDom="doc2">
<document>
<description>This is second document.</description>
</document>
</x:parse> 
<x:parse varDom="doc3">
<document>
<description>This is third document.</description>
</document>
</x:parse> 
<c:set var="xslt">
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" omit-xml-declaration="yes" indent="yes" />
<xsl:param name="doc2"/>
<xsl:param name="doc3"/>

<xsl:template match="/">
<xsl:value-of select="/document/description" /><br />
<xsl:value-of select="$doc2/document/description" /><br />
<xsl:value-of select="$doc3/document/description" /><br />
</xsl:template>

</xsl:stylesheet>
</c:set> 
<html>
<head><title>Example of x:param tag of JSTL</title></head>
<body>
<x:transform xml="${doc1}" xslt="${xslt}">
<x:param name="doc2" value="${doc2}" />
<x:param name="doc3" value="${doc3}" />
</x:transform>
</body>
</html>


Output :



Download Source Code 

Related Tags for Use of tag of JSTL:
cxmllibraryfilefilesstlormantformiousersedjstltagparametertransformthisjsforaddtolearnrameareillibsectionliuseinmlrmrarmntpartrwanddjadesmehowparamwhensishallmetereaarwantxmssthstono


More Tutorials from this section

Ask Questions?    Discuss: Use of tag of JSTL  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.