Hi James,
What we really need to do is turn the JSP into a well formed XML document.
This would require that any HTML in the JSP be XHTML.
Convert any <% ... %> to <jsp:... >
Add the correct XML to wrap the JSP.
Merge in the XML for the TLD for the current taglib with the JSP XML.
Then the examples.xsl can style it, highlighting JSP tags in general,
and emphasizing the tags for the current taglib.
I would prefer if we created some generic ant tasks that we can contribute
back to the Ant Project. The replace ant task is too restrictive. We could
add a nested <header file=""/> and <footer file=""> to the replace task.
Then perhaps clone the replace task and create a regexp task. The regexp
task could be used to run multiple substitution regular expressions on the
source file. The regular expressions could be used to transform the JSP
page into a valid XML document by using regexp to escape rtexprvalues,
and replace <%@ with jsp:directive. <%! with jsp:declaration <%= with
jsp:expression <%-- with jsp:comment, etc.
Regards,
Glenn
James Strachan wrote:
>
> Hi Glenn
>
> Thanks for that suggestion - I think its pretty good.
>
> Apart from integrating jjar so folks don't need to manually download lots of
> JARs and tinker with build.properties, its the building of the example JSP
> sources that I find the most frustrating, its so easy to have an example JSP
> that doesn't pass through the example.html step. (e.g. It took me a long
> time to get the examples in xtags & log to build).
>
> I'm wondering if there's any other way of doing this via Ant - I'd rather
> not have to add marker comments to the top and bottom of every JSP - just
> because I know we'll all forget to add them from time to time and get build
> errors.
>
> I don't think there's a sed/awk Ant task yet :), so I wonder why don't we
> write a simple Ant task ourselves? A simple Java ant task that takes a JSP
> and turns it into HTML by hand? One thing I'd love to see is the use of
> colour coding to highlight sections that map onto custom tags. Sounds like a
> job for regexp ;-)
>
> Even just a simple Ant task that prepends and appends a header & footer to
> each file would do the trick?
>
> James
>
> ----- Original Message -----
> From: "Glenn Nielsen" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, July 25, 2001 12:04 AM
> Subject: Re: [UPDATE] Converting existing taglibs to use new build
>
> > James,
> >
> > I think I have a solution for you to try with the io taglib, if it works
> > there we can switch the rest of the taglib examples over to it.
> >
> > To convert the document using the examples.xsl stylesheet we have to
> > make sure we insert a few lines at the head of the document, and insert
> > a few lines at the tail.
> >
> > What if we used JSP comments to indicate the head and tail of the JSP
> page.
> >
> > i.e.
> >
> > <%-- HEAD --%>
> > <%@taglib .... %>
> > .
> > .
> > .
> > .
> > <%-- TAIL -%>
> >
> > The JSP comments get stripped out by the JSP translator and shouldn't
> > affect the content generated by the JSP when run. But they would be
> > available for use as tokens to replace when converting the example jsp
> > to XML in preparation for applying the examples.xsl stylesheet.
> >
> > I think this solution should work for any JSP no matter what type of
> > output it generates.
> >
> > Regards,
> >
> > Glenn
> >
> > James Strachan wrote:
> > >
> > > Hi Glenn
> > >
> > > > OK now io, log and xtags are all converted over to the new build
> process.
> > >
> > > BTW I forgot to mention, I modified the common.xml file slightly as the
> > > example.html target was causing massive problems for the io taglib. Many
> of
> > > the example JSP files in the io taglib are not HTML, nor are valid XML
> and
> > > are intended to produce XML. This caused the example.html target to
> barf.
> > >
> > > So the easiest way I could see of making the io taglib compliant was
> just to
> > > disable the example.html part of the build process for the io taglib.
> > >
> > > Any taglib may now disable this step by defining the property
> > > disable.example.html to be true. I made sure that the current i18n
> taglib
> > > defines this variable too until it gets ported along as well.
> > >
> > > James
> > >
> > > _________________________________________________________
> > > Do You Yahoo!?
> > > Get your free @yahoo.com address at http://mail.yahoo.com
> >
> > --
> > ----------------------------------------------------------------------
> > Glenn Nielsen [EMAIL PROTECTED] | /* Spelin donut madder |
> > MOREnet System Programming | * if iz ina coment. |
> > Missouri Research and Education Network | */ |
> > ----------------------------------------------------------------------
> >
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
--
----------------------------------------------------------------------
Glenn Nielsen [EMAIL PROTECTED] | /* Spelin donut madder |
MOREnet System Programming | * if iz ina coment. |
Missouri Research and Education Network | */ |
----------------------------------------------------------------------