Is it possible to read a value generated from within an XSL file into a JSP?
Rashmi Rubdi <[email protected]>
| Newsgroups | gmane.comp.jakarta.taglibs.user |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I am trying to read a value that is generated inside an XSLT file (session_test.xsl ) , in to the JSP file (session_test.jsp) that contains the code to transform the XML (session_test.xml)
I want to store the value of sub-node , and the value of the generated id as session parameters inside the JSP file.
Is there a way to read a value generated inside an XSL into the JSP ?
session_test.xml
<?xml version="1.0" encoding="UTF-8"?>
<root-node>
<some-nodes>
<node>
<sub-node>some_value_1</sub-node>
</node>
<node>
<sub-node>some_value_2</sub-node>
</node>
<node>
<sub-node>some_value_3</sub-node>
</node>
<node>
<sub-node>some_value_4</sub-node>
</node>
</some-nodes>
</root-node>
-----------------------------
session_test.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes"/>
<xsl:template match="/">
<xsl:for-each select="root-node/some-nodes/node">
<xsl:value-of select="sub-node"/>
<br/>
<xsl:value-of select="generate-id()"/>
<hr/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
----------------------------------
session_test.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
<html>
<head><title></title></head>
<body>
<c:import url="session_test.xml" var="xml" charEncoding="UTF-8"/>
<c:import url="session_test.xsl" var="xsl" charEncoding="UTF-8"/>
<x:transform doc="${xml}" xslt="${xsl}"/>
</body>
</html>
-Thank you
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com