Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within XML
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
XML and Related Technologies
Transforming web.xml
Jeff Pierce
Greenhorn
Posts: 13
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I want to take an existing web.xml file and transform it directly only changing a single <init-param>/<param-value> in the process and I can't seem to find the best way.
For example, I want to transform the listing value from true to false.
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee <a href="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"" target="_blank" rel="nofollow">http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"</a> version="2.4"> <servlet> <!-- repeats several times --> <servlet-name>fred</servlet-name> <servlet-class>servlets.fred</servlet-class> <init-param> <param-name>debug</param-name> <param-value>0</param-value> </init-param> <init-param> <param-name>listings</param-name> <param-value>true</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> ....
To this:
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee <a href="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"" target="_blank" rel="nofollow">http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"</a> version="2.4"> <servlet> <!-- repeats several times --> <servlet-name>fred</servlet-name> <servlet-class>servlets.fred</servlet-class> <init-param> <param-name>debug</param-name> <param-value>0</param-value> </init-param> <init-param> <param-name>listings</param-name> <param-value>[B]false[/B]</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> ....
Jeff Pierce
Greenhorn
Posts: 13
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I should add I only want to change it for
servlet
"fred", not all the other servlets within the web.xml.
pranav pranav
Greenhorn
Posts: 9
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
check this , I am not sure
<xsl:for-each select="//servlet/init-param">
<xsl:variable name="initivalue">
<xsl:value-of select="param-name"/>
</xsl:variable>
<xsl:if test="$initivalue = 'listings'">
<xsl:variable name="paramvalue">
<xsl:value-of select="param-value"/>
</xsl:variable>
<xsl:if test="$paramvalue = 'true'">
<param-value>false</param-value>
</xsl:if>
</xsl:if>
</xsl:for-each>
Consider Paul's
rocket mass heater
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
An Error Occured while starting tomcat
Need the techinical help for running sample struts program using Myeclipse5.1.1
JspException: Failed to obtain specified collection for Struts:optionscollection
implicit object config
Deployment descriptor "web.xml" is malformed
More...