0

Hello,

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

<web-app>
 <display-name>My Application</display-name>
  <!-- Standard Action Servlet Configuration (with debugging) -->
  <servlet>
    <servlet-name>TestServlet</servlet-name>
    <servlet-class>com.mycompany.MyServlet</servlet-class>
  </servlet>

  <!-- Standard Action Servlet Mapping -->
  <servlet-mapping>
    <servlet-name>TestServlet</servlet-name>
    <url-pattern>/first</url-pattern>
  </servlet-mapping>

</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.

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by fpmurphy
0
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" >
  <xsl:param name="find">servlet</xsl:param>

  <xsl:output method="text" encoding="utf-8"/>

  <xsl:template match="node()">
    <xsl:value-of select="count(//*[local-name()=$find])"/>
    <xsl:text>&#xa;</xsl:text>
  </xsl:template>

</xsl:stylesheet>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.