[
Lists Home |
Date Index |
Thread Index
]
On Sat, 29 Jan 2005 10:02:17 -0500, Alan Gutierrez
<alan-xml-dev@engrm.com> wrote:
<snip/>
> I'm not sure how to ask the question. Let's say you have a file
> that's a project.
>
> <project>
> <source>
> <name>main</name>
> <dir>src/main</dir>
> <category>dist</category>
> </source>
> </project>
>
> Project directory:
>
> /project
> /src
> /java
> /resource
>
> Use the above to generate an Ant script. I run a transform and I
> have javac, junit, javadoc, jar, svn, and distrubute tasks.
>
> How do I allow a user to plug in a new set of tasks to generate?
>
> This is a general problem I'm having, how do you create hooks,
> callbacks, er, how do you create an XSLT framework?
One way to do this would be to make it data driven. In the framework
class you build some variable that is the master list of tasks and
some well defined calls to initialize the list and then process it.
Any framework class can then modify the list as needed and then pass
control back. Eg, in the framework:
<xsl:variable name="tasks">
<javac/><junit/><javadoc/><jar/><svn/><distrubute/>
</xsl:variable>
<xsl:template name="init">
<xsl:apply-templates select="tasks" mode="process/>
</xsl:template>
Then the users of the framework implement "init" with a higher
priority and call the same modal templates. They add their own task
specific templates with the same mode as needed. Of course, with this
approach you're also likely looking at adding some parameter that is
the real data to be passed from the main call, to the init and then on
to the processing tasks....
--
Peter Hunsberger
|