XPath for web.xml

Please support our XML, XSLT and XPATH advertiser: Intel Parallel Studio Home
Reply

Join Date: Jan 2009
Posts: 1
Reputation: kaprasanna is an unknown quantity at this point 
Solved Threads: 0
kaprasanna kaprasanna is offline Offline
Newbie Poster

XPath for web.xml

 
0
  #1
Jan 8th, 2009
Hello,

Is it possible to write xpath expressions that will query a web server's web.xml like this one :

XML, XSLT and XPATH Syntax (Toggle Plain Text)
  1. <web-app>
  2. <display-name>My Application</display-name>
  3. <!-- Standard Action Servlet Configuration (with debugging) -->
  4. <servlet>
  5. <servlet-name>TestServlet</servlet-name>
  6. <servlet-class>com.mycompany.MyServlet</servlet-class>
  7. </servlet>
  8.  
  9. <!-- Standard Action Servlet Mapping -->
  10. <servlet-mapping>
  11. <servlet-name>TestServlet</servlet-name>
  12. <url-pattern>/first</url-pattern>
  13. </servlet-mapping>
  14.  
  15. </web-app>

I would want to know if a particular web.xml has certain set of tags present or not. Like <servlet> and </servlet>
And if yes to get their count.
How can this be achieved using XPath expressions?

Tahnks.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 100
Reputation: fpmurphy is an unknown quantity at this point 
Solved Threads: 5
fpmurphy fpmurphy is offline Offline
Junior Poster

Re: XPath for web.xml

 
0
  #2
Jan 8th, 2009
XML, XSLT and XPATH Syntax (Toggle Plain Text)
  1. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" >
  2. <xsl:param name="find">servlet</xsl:param>
  3.  
  4. <xsl:output method="text" encoding="utf-8"/>
  5.  
  6. <xsl:template match="node()">
  7. <xsl:value-of select="count(//*[local-name()=$find])"/>
  8. <xsl:text>&#xa;</xsl:text>
  9. </xsl:template>
  10.  
  11. </xsl:stylesheet>
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the XML, XSLT and XPATH Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC