tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Liem Do" <l...@waterware.com>
Subject Re: jspc ant task and merge web.xml
Date Thu, 03 Jul 2003 19:34:59 GMT
You could also use the <style> task to do this.

== START EXAMPLE ==
== build.xml ==
  <xmlcatalog id="commondtds">
        <dtd
            publicId="-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN"
            location="${src}/conf/web-app_2_3.dtd"/>
  </xmlcatalog>
   <target name="jspc">
   <.. your jspc calls here should output the web.xml file to a file called
webjspc.xml />
    <!-- Build the new web.xml file with the servlet mappings created from
the jspc script -->
    <style in="${src}/config/web.xml" out="${build}/web.xml"
         style="${src}/config/webmerge.xsl">
     <param name="includeFile" expression="${src}/config/webinc.xml"/>
     <xmlcatalog refid="commondtds"/>
    </style>
  </target>

== webmerge.xsl ==
<?xml version="1.0"?>
<xsl:stylesheet
 version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

 <xsl:output method="xml" indent="yes"  encoding="ISO-8859-1"
        doctype-public="-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN"
        doctype-system="http://java.sun.com/dtd/web-app_2_3.dtd"/>
 <xsl:param name="includeFile"/>
 <!-- get the required elements of "web-app", in their defined order,
      according to the DTD. -->
 <xsl:template match="/web-app">
   <web-app>
     <xsl:apply-templates select="icon"/>
     <xsl:apply-templates select="display-name"/>
     <xsl:apply-templates select="description"/>
     <xsl:apply-templates select="distributable"/>
     <xsl:apply-templates select="context-param"/>
     <xsl:apply-templates select="filter"/>
     <xsl:apply-templates select="filter-mapping"/>
     <xsl:apply-templates select="listener"/>
     <xsl:apply-templates select="servlet"/>
     <xsl:copy-of select="document($includeFile)/web-app/servlet"/>
     <xsl:apply-templates select="servlet-mapping"/>
     <xsl:copy-of select="document($includeFile)/web-app/servlet-mapping"/>
     <xsl:apply-templates select="session-config"/>
     <xsl:apply-templates select="mime-mapping"/>
     <xsl:apply-templates select="welcome-file-list"/>
     <xsl:apply-templates select="error-page"/>
     <xsl:apply-templates select="taglib"/>
     <xsl:apply-templates select="resource-env-ref"/>
     <xsl:apply-templates select="resource-ref"/>
     <xsl:apply-templates select="security-constraint"/>
     <xsl:apply-templates select="login-config"/>
     <xsl:apply-templates select="security-role"/>
     <xsl:apply-templates select="env-entry"/>
     <xsl:apply-templates select="ejb-ref"/>
     <xsl:apply-templates select="ejb-local-ref"/>
   </web-app>
 </xsl:template>
 <xsl:template match="*">
   <xsl:for-each select="@*">
     <xsl:attribute name="{.}">
       <xsl:value-of select="."/>
     </xsl:attribute>
   </xsl:for-each>
   <xsl:copy-of select="."/>
 </xsl:template>
</xsl:stylesheet>

== webinc.xml ==
<?xml version="1.0"?>
<!DOCTYPE web-app
  PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
  "http://java.sun.com/dtd/web-app_2_3.dtd"
[
<!ENTITY webinc PUBLIC "webinc" "file:../build/webjspc.xml">
]
>
<web-app>
 &webinc;
</web-app>

== END EXAMPLE ==

----- Original Message ----- 
From: "Elisabeth Rotbach" <ejlejl@hotmail.com>
To: <tomcat-user@jakarta.apache.org>
Sent: Thursday, July 03, 2003 10:10 AM
Subject: Re: jspc ant task and merge web.xml


>
> To merge several xml, I use : xmltask from http://www.oopsconsultancy.com.
>
> EJL
> Toulouse
>
>
> >From: BOULAY Arnaud <arnaud.boulay-renexter@renault.com>
> >Reply-To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
> >To: tomcat-user@jakarta.apache.org
> >Subject: jspc ant task and merge web.xml
> >Date: Thu, 03 Jul 2003 16:33:30 +0200
> >
> >Hi !
> >I want to do an automatic merge of "newweb.xml" file generated with
<jspc>
> >task with an existing  web.xml.
> >Thanks in advance.
> >Regards, Arnaud
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
>
> _________________________________________________________________
> MSN Messenger 6 http://g.msn.fr/FR1001/866  : dialoguez en son et en image
> avec vos amis.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message