Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

Kevin Fay

Greenhorn
+ Follow
since Feb 13, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Kevin Fay

I need to locate an index server that is a free download. Any recommendations. I'm running Websphere 3.5 app server on NT 4. I'm using Apache's HTTP server. Appreciate the help!! thanx
19 years ago
Here is the answer. I've noticed that this board is very slow to help....(I'll keep this in mind in the future) Looks like a lot of people just want answers and don't contribute!!!
http://www.javaranch.com/ubb/Forum31/HTML/000376.html
19 years ago
In this solution I have 2 JSP's, and one XSL file.
checkbook_request.jsp (a.k.a JSP1) looks like this...........
<HTML>
<HEAD>
<TITLE>DynamicTestRequest</TITLE>
<BODY>
<FORM METHOD="POST" action="checkbook1.jsp">
Enter the xml here:
<textarea name="xmlsource"></textarea>
<br>
<br>
<br>
<input type="submit" name="submit" value="ENTER">
<br>
</FORM>
</BODY>
</HTML>
As you can see it posts to checkbook1.jsp
Checkbook1.jsp looks like this...
<%
String xml = request.getParameter("xmlsource");
%>
<script language="javascript">
// Load XML
var xml = new ActiveXObject("MSXML2.DOMDocument.3.0")
xml.async = false
xml.loadXML('<%=xml%>')
// Load the XSL
var xsl = new ActiveXObject("MSXML2.DOMDocument.3.0")
xsl.async = false
xsl.load("checkbook1.xsl")
// Transform
document.write(xml.transformNode(xsl))
</script>

my xsl page looks like this.........
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">;
<xsl:template match="/">
<HTML>
<STYLE>
.hdr {font-family:Verdana;font-size:9pt;border-bottom:1px black solid;font-weight:bold;}
.normal {font-family:Verdana;font-size:8pt;border-bottom:1px silver solid;}
</STYLE>
<SCRIPT language="JavaScript"><xsl:comment><![CDATA[
function colorItem(num)
{
if (num<0)
{
document.write("<FONT COLOR='red'>"+num+"</FONT>");
}
else
{
document.write(num);
}
return;
}

]]></xsl:comment></SCRIPT>
<BODY>
<CENTER>
<TABLE BORDER="0" BORDERCOLOR="silver" CELLSPACING="0" CELLPADDING="5" WIDTH="60%">
<TR>
<TD CLASS="hdr">DATE</TD>
<TD CLASS="hdr">ID</TD>
<TD CLASS="hdr">ENTRY</TD>
<TD CLASS="hdr" COLSPAN="3">AMOUNT</TD>
</TR>
<xsl:for-each select="//checkbook/entry" order-by="number(transdate)">
<DIV STYLE="display:none;"><xsl:eval>IsNeg=0</xsl:eval></DIV>
<TR>
<TD CLASS="normal"><xsl:value-of select="@id" /></TD>
<TD CLASS="normal"><xsl:value-of select="transdate" /></TD>
<TD CLASS="normal"><xsl:value-of select="description" /></TD>
<TD CLASS="normal">
<xsl:element name="SCRIPT">
colorItem('<xsl:value-of select="amount" />')
</xsl:element>
</TD>
</TR>
</xsl:for-each>
</TABLE>
</CENTER>
</BODY>
</HTML>
</xsl:template>

</xsl:stylesheet>

Now I entered in an XML string in the textarea of checkbook_request.jsp that looked like this.......
<checkbook><entry id="1"><transdate>20001011</transdate><description>Gas</description><amount>-12.30</amount> </entry><entry id="2"><transdate>20001011</transdate><description>PAID</description><amount>+100.30</amount></entry><entry id="1"><transdate>20001012</transdate><description>VISA</description><amount>-211.11</amount></entry></checkbook>
Make sure you have the latest version of MSXML, version 3.
I need help integrating MSXML3 within a JSP page in a web format.
I have an XSL file as such:
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">;
<xsl:template match="/">
<HTML>
<STYLE>
.hdr {font-family:Verdana;font-size:9pt;border-bottom:1px black solid;font-weight:bold;}
.normal {font-family:Verdana;font-size:8pt;border-bottom:1px silver solid;}
</STYLE>
<BODY>
<CENTER>
<TABLE BORDER="0" BORDERCOLOR="silver" CELLSPACING="0" CELLPADDING="5" WIDTH="60%">
<xsl:for-each select="//books/book">
<TR>
<TD CLASS="normal"><xsl:value-of select="title" /></TD>
<TD CLASS="normal"><xsl:value-of select="quantity" /></TD>
<TD CLASS="normal"><xsl:value-of select="price" /></TD>

</TR>
</xsl:for-each>
</TABLE>
</CENTER>
</BODY>
</HTML>
</xsl:template>

</xsl:stylesheet>
-----------------------------------------------------------------
Assume the XML is good XML that conforms to what the XSL is looking for.
I want to dynamically pass an XML string from one JSP page(JSP1) to another (JSP2) that will:
1. get the xml string from the querystring
2. load the XSL page above
3. send these 2 sources to a parser (preferably DOM/MSXML3)
4. display HTML
What is the syntax of my JSP 2 that will perform the following 4 points above?

------------------
19 years ago