I've been following this discussion and find your example below interesting.
I've also been reading about tab librarys and just downloaded JRun's most
recent one (ships with JRun 3.0 CR1). The library isn't tied to JRun
specifically, but there's a feature that might help out with this. I haven't
actually used the library, but from reading the docs perhaps it'll help. Let
me explain.

The example again...

> Let's see if I get the whole process with a very small sample
>
> 1.- You give the XML file to the designer
> <Customer
>         Name="John Doe">
>         <Account ID="01" Balance="1230$">
>         <Account ID="02" Balance="-50$">
> </Customer>
>
> 2.- The designer wants to produce the following output
> <table>
>         <tr><td>Name:</td><td>John Doe</td></tr>
>         <tr><td>Account 01</td><td>12030$</td></tr>
>         <tr><td>Account 02</td><td bgcolor="red">-50$</td></tr>
> </table>
>
> 3.- So he produces this XSLT
> <xsl:template match="Customer">
>         <table>
>         <tr><td>Name:</td><td><xsl:value-of select="@Name"
> /></td></tr>
>         <xsl:apply-templates select="Account"  />
>         </table>
> </xsl:template>
> <xsl:template match="Account">
>         <tr>
>         <td>Account <xsl:value-of select="@ID" /></td>
>         <td>
>                 <xsl:if test="@Balance<0">
>                         <xsl:attribute
> name="bgcolor">red</xsl:attribute>
>                 </xsl:if>
>                 <xsl:value-of select="@Balance" />
>         </td>
>         </tr>
> </xsl:template>
>
> 4.- The JSP you would like to produce would be something like..

Assuming you have customer.xml (#1 above) and customer.xsl (#3 above) as
files in the same directory, you could use the xslt tag to perform the XSL
transformation of the xml. The syntax would be:

<%@ taglib uri="/WEB-INF/taglib.tld" prefix="stl" %>
<stl:xslt xml="customer.xml" xsl="customer.xsl"/>

If customer.xml was dynamically produced, you could use this alternative
syntax:

<stl:xslt xsl="customer.xsl">
  <Customer Name="John Doe">
    <Account ID="01" Balance="1230$">
    <Account ID="02" Balance="-50$">
  </Customer>
</stl:xslt>

There's other tags/tools for getting ResultSets into XML documents that
could produce the above code, but that's another topic :-). Since all of
your display logic and format are in the xsl file, there's no need to redo
these in the JSP. Changing of logic would require a change to your xsl file
but not your JSP file, since it's just putting the xml on the page.

Might this be a viable option?

                                                                ryan

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to