ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sivaprasad.Kanche...@itsindia.com
Subject Re: Creating EJB Deployment Descriptors
Date Wed, 29 Aug 2001 06:18:23 GMT
Kyle,

Thanks for your solution. It works very well. I have one more question
though, more related to xslt than Ant

Following your solution, I have made the following files. There is a
ejb-jar-values.xml of the following format.

<root>
     <dev>
          <name> value for dev </name>
     </dev>
     <stage>
          <name> value for stage </name>
     </stage>
<root>

The ejb-jar.xsl template file needs to pick up the values from the
ejb-jar-values.xml file based on dev/stage and create ejb-jar.xml file. How
do I make ant tell the xsl file that it has to pick up either of the
dev/stage elements for the needed values. The param element of style task
did not work.

- Siva


List:     ant-user
Subject:  Re: Creating EJB Deployment Descriptors
From:     "Kyle Adams" <kadams@gfs.com>
Date:     2001-08-08 17:09:28
[Download message RAW]

kadams@gfs.com 08/08/01 11:37AM:
> If you need more info, or are unfamiliar with XSLT, I'd be willing to
> post some resources that I've found helpful.

Well, it seems there is some interest in this.

DISCLAIMER: I'm pretty inexperienced with XSLT.  Until about a week
ago, I had no experience.  Then a project of mine evolved to the point
that XSLT was necessitated, so I've been on a crash course for about a
week.  These resources come from the perspective of a newbie, for fellow
newbies.

I've been to xml.com, webmonkey.com, builder.com (and probably a few
others) to read their respective intros to XSLT.

At xml.com:
http://www.xml.com/pub/a/2000/08/holman/index.html
http://www.xml.com/pub/q/transformingxml - a column on XSLT

At webmonkey.com:
http://hotwired.lycos.com/webmonkey/98/43/index2a.html?tw=authoring

At builder.com:
http://builder.cnet.com/webbuilding/pages/Programming/XMLToday/ss03.html?tag=st.bl.7267.dir1.XMLToday_03
http://builder.cnet.com/webbuilding/pages/Programming/XMLToday/?tag=st.bl.7267.pro_hXMLToday


In general, I've found the builder.com articles to be the best as far
as being understandable and being most applicable to Ant.  The stylesheets
I'm using now are based (very loosely) off of the ones presented in the
builder.com articles.

I use Saxon as my XSLT parser, as it was recommended to me by other
XSLT gurus on this list.

http://saxon.sourceforge.net/

The Saxon User Manual has also been a nice "pocket reference" for XSLT.

http://saxon.sourceforge.net/saxon6.4.2/index.html

Specifically, I'm constantly referring to the pages on XSL elements and
XPath.

http://saxon.sourceforge.net/saxon6.4.2/xsl-elements.html
http://saxon.sourceforge.net/saxon6.4.2/expressions.html

I've given remote links here, but the user manual is also included when you
download Saxon.

Lastly, be sure to check all the XSLT-related posts on this list by
searching
the archives at:

http://marc.theaimsgroup.com/?l=ant-user&r=1&w=2

A few final words: the builder.com articles gave me a good idea (at least,
I
think it's good) on how utilize XSLT in my Ant files.  This, to me, has
been
the toughest part about diving into XSLT - figuring out exactly what from
my
Ant script should be in the XSL file, and what should be in the XML file.
Here's
what I've ended up with (presented in an abridged and snipped format):

BUILD.XSL
==========
<xsl:variable name="PROJECT_NAME" select="application/@name"/>

<xsl:template match="application">
  <project name="{$PROJECT_NAME}" default="all" basedir=".">
    <!-- load property files, specify the init target, all general "build"
file things here -->
    <xsl:apply-templates select="build"/>
  </project>
</xsl:template>

<xsl:template name="compile" match="target[@name='compile']">
  <target name="compile" depends="init">
    <!-- do various compiling-type things here -->
  </target
</xsl:template>

FOO.XML
=========
<application name="foo">
  <build default="clean, compile">
    <target name="get"/>
    <target name="clean"/>
    <target name="refresh"/>
    <target name="compile"/>
    <target name="deploy"/>
  </build>
</application>

Sorry for the long post, but this is one of the topics in the Ant community
that is least documented, and most in need of documentation.  Maybe I'll
have to sit down and write something out one of these day :-)  Eh, better
wait until I have some more experience...

Kyle


> List:     ant-user
> Subject:  Creating EJB Deployment Descriptors
> From:     Sivaprasad.Kancherla@itsindia.com
> Date:     2001-08-08 9:31:20
> [Download message RAW]
>
> We have three ejb-jar.xml files for each EJB, one each for
> development/staging/production environment. Right now we are maintaining
> them as ejb-jar.xml.dev, ejb-jar.xml.stage, ejb-jar.xml.prod files. Ant
> picks up the respective files depending on the environment for which the
> build is made.
>
> Now I am looking for a more elegant solution. The proposed way is as
> follows. I have a ejb-jar.xml.template file and a properties file which
> will contain all the values for all the environments. Reading the
> respective property values, I am planning to insert them in the
> ejb-jar.xml.template file using 'Replace' task of Ant.
>
> Is this is standard way of doing this kind of stuff? Or is there any
other
> simple, elegant way of doing the same?
>
> Thanks,
> Siva
>


Mime
View raw message