When I first started out with JSP/Servlets, one thing I really liked was the
statement:
Write once, run on every web-server (which supports JSP/Servlets).
What happens when you use those libraries? Can you still move it from one
web-server to another? Or do I have to rewrite the code in order to move it
to another platform?
Date: Wed, 01 Aug 2001 15:50:01 -0500
From: "Haseltine, Celeste" <[EMAIL PROTECTED]>
Subject: RE: Applying Xsl
Message-ID: <[EMAIL PROTECTED]>
Use the built in tag library, if you are using version 3.01 or greater.
An example:
TESTXML.JSP:
<html>
<head>
<title>xslt Tag Example</title>
</head>
<body>
<!--Get data from database to convert to XML file-->
<jrun:sql datasrc="NYTC" id="rs1">
SELECT StockType.StockAmt, StockType.StockTypeDesc,
StockDetails.MICR1, StockType.Image2URL
FROM StockDetails INNER JOIN
StockType ON
StockDetails.StockID = StockType.StockTypeID
WHERE (StockDetails.StockID = 1)
</jrun:sql>
<jrun:param id ="rs1" type="QueryTable"/>
<jrun:xslt xsl="TestXMLPrint.xsl">
<jrun:query2xml query="rs1" type="DOM" scope="session"/>
</jrun:xslt>
</body>
</html>
TESTXMLPRINT.XSL:
<xsl:stylesheet id="style1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns="http://www.w3.org/Graphics/SVG/SVG-19990812.dtd">
<xsl:output method="html" media-type="image/svg"/>
<xsl:template match="table">
<table border="0" width="600">
<tr><th>StockAmt</th><th>StockTypeDesc</th><th>MICR1</th><th>ImageURL</th></
tr>
<xsl:apply-templates/>
</table>
</xsl:template>
<xsl:template match="row">
<tr><xsl:apply-templates/></tr>
</xsl:template>
<xsl:template match="StockAmt">
<td><xsl:apply-templates/></td>
</xsl:template>
<xsl:template match="StockTypeDesc">
<td><xsl:apply-templates/></td>
</xsl:template>
<xsl:template match="MICR1">
<td><font face="MICRe13b"
size="5"><xsl:apply-templates/></font></td>
</xsl:template>
<xsl:template match="Image2URL">
<td><img src="../images/MBUTTONdark.gif" width="38"/></td>
</xsl:template>
</xsl:stylesheet>
If you decide NOT to use the tag library, you will need to write out the XML
data from the recordset. That gets a little more complicated, but JRUN's
<jrun:xslt> tag allows you to specify an XML file to bind the XSLT to. See
the JRUN tag library documentation (separate Adobe download) on JRUN's web
site.
Hope this helps!!!
Celeste
-----Original Message-----
From: Bert [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 01, 2001 2:45 PM
To: JRun-Talk
Subject: Applying Xsl
What is the Best way to apply a Xslt transformation style sheet in a Jsp
page via Jrun?
Bert
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists