aspose file tools*
The moose likes XML and Related Technologies and the fly likes xsl variables to core set Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "xsl variables to core set" Watch "xsl variables to core set" New topic
Author

xsl variables to core set

Rob Stan
Greenhorn

Joined: Jan 20, 2011
Posts: 7
Hey guys,

I am completely new to this and I am still learning.

I need to pass a variable something like this

<xsl:variable name="test" select="description"/>
<c:set var="message" value="${test}" />

Is this at all possible or am I barking up the worng tree.
I need the set var as a string so I can pass it to another tag.

Thanks
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6657
    
    5

xsl variable mixed with a c:set JSP file ?

XSL commands are part of a XSLT process. I am not sure I understand your question. How are the XML / XSLT / JSP files related ?


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Rob Stan
Greenhorn

Joined: Jan 20, 2011
Posts: 7
Well (still being new to this) it is all happening in the same file.

Deepak Bala wrote:xsl variable mixed with a c:set JSP file ?

XSL commands are part of a XSLT process. I am not sure I understand your question. How are the XML / XSLT / JSP files related ?
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6657
    
    5

Is this a XML file ?

My best guess is that a XSL transformation rule runs on a XML file to produce a JSP which contains the c:set element. Is that the case ?
Rob Stan
Greenhorn

Joined: Jan 20, 2011
Posts: 7
Well I think that to be the case.
The <c:set> I have actually added.

I am using given code and I have not written it myself.

<xsl:variable name="test" select="description"/>

What I want to do is take the xsl variable which is in fact just a string of text
and pass it to and set it as a global so that I can use that global in another
taglib.

<c:set var="message" value="${test}" />

Mind you as I have said I am still new to this and I am sure
I understand the way to think yet.

Appreciate the help.

Deepak Bala wrote:Is this a XML file ?

My best guess is that a XSL transformation rule runs on a XML file to produce a JSP which contains the c:set element. Is that the case ?
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6657
    
    5

I think the best thing to do is to step back and look at what you want to do.

You have a XML file that a XSLT works on a to give an output file. Is this output file a JSP or HTML ? What is your requirement ?
Rob Stan
Greenhorn

Joined: Jan 20, 2011
Posts: 7
Yes, I think you are right. I need to learn more how this all works.

The output is in html to my understanding.

Deepak Bala wrote:I think the best thing to do is to step back and look at what you want to do.

You have a XML file that a XSLT works on a to give an output file. Is this output file a JSP or HTML ? What is your requirement ?
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6657
    
    5

The output is in html to my understanding.


Cool. So what is the nature of the change that you want to make to this file ? Someone requested new data to become available in the view ?
Rob Stan
Greenhorn

Joined: Jan 20, 2011
Posts: 7
Well, yes and no (take into consideration that this is still all new to me).
Let's assume that it is suppose to be available in the view.
How would I do that?

Deepak Bala wrote:
The output is in html to my understanding.


Cool. So what is the nature of the change that you want to make to this file ? Someone requested new data to become available in the view ?
Shashank Ag
Ranch Hand

Joined: Dec 22, 2009
Posts: 88

Well Rob I am assuming here you are completely newbee, so I am stating some fundamentals here:

1. XSL is used as template to generate html document.
In XSL you have various place holders which specify dynamic data.
Now to use this template, a XML is mapped upon XSL for this tag hirarchy XML should correspond to XSL place holders.
The combined output is html. This whole api is availble in J2SE only, so you can generate html pages out of desktop application.

2. JSP technology is based upon java servlet api. It acts as template to produce html. It is part of J2EE.

Well, uptil here they seem to be compareable in terms of end result. But, they do not mix/gel togather as purposes of each is different.
A JSP/Servlet is equipped with servlet lifecycle. It has all the fundamental specifications to be developed as a full fleged, dynamic web application.
While, XSL is only for smaller roles like generating a html report from application or likewise.

In short below will nerver gel togather.
<xsl:variable name="test" select="description"/>
<c:set var="message" value="${test}" />


SCJP 91%, SCWCD 97%
Rob Stan
Greenhorn

Joined: Jan 20, 2011
Posts: 7
Thanks guys, I really appreciate the support.
I found a work around that I can use, I am sure I am breaking many paradigms though
And yes, I am still learning all this.

This is what I did, using some JavaScript

<%String myVar = "<xsl:variable name=\"test\" select=\"description\"/>"; %>
<%=myVar%>

Thanks agian guys!

Rob

Shashank Ag wrote:Well Rob I am assuming here you are completely newbee, so I am stating some fundamentals here:

1. XSL is used as template to generate html document.
In XSL you have various place holders which specify dynamic data.
Now to use this template, a XML is mapped upon XSL for this tag hirarchy XML should correspond to XSL place holders.
The combined output is html. This whole api is availble in J2SE only, so you can generate html pages out of desktop application.

2. JSP technology is based upon java servlet api. It acts as template to produce html. It is part of J2EE.

Well, uptil here they seem to be compareable in terms of end result. But, they do not mix/gel togather as purposes of each is different.
A JSP/Servlet is equipped with servlet lifecycle. It has all the fundamental specifications to be developed as a full fleged, dynamic web application.
While, XSL is only for smaller roles like generating a html report from application or likewise.

In short below will nerver gel togather.
<xsl:variable name="test" select="description"/>
<c:set var="message" value="${test}" />

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: xsl variables to core set
 
Similar Threads
Matching 2 inputs in validator.xml (Struts 1)
Why Var-arg type is required when we have a array type
pass bean data to javascript function
JSTL ternary ?
setting var attribute in classic custom tag