Re: Is it possible to read a value generated from within an XSL file into a JSP?

Kris Schneider <[email protected]>
Newsgroups gmane.comp.jakarta.taglibs.user
Message-ID <[email protected]>
If you store the result of your transform in a var:

<x:transform var="transformed" doc="${xml}" xslt="${xsl}"/>

Then you can use <x:set>/<x:out> with an XPath expression to grab what you need.
Will that help or have I misunderstood what you're trying to do?

Quoting Rashmi Rubdi <[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

-- 
Kris Schneider <mailto:[email protected]>
D.O.Tech       <http://www.dotech.com/>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.