I want to read an XML file like below
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/com.ibm.ws.st.core.runtimeClasspathProvider/com.ibm.worklight"/>
<classpathentry kind="con" path="com.worklight.studio.plugin.classpath.SERVER_CONTAINER"/>
<classpathentry kind="src" path="server/java"/>
<classpathentry kind="src" path="common"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" output="adapters/adp1/bin" path="adapters/agent/src"/>
<classpathentry kind="src" output="adapters/adp2/bin" path="adapters/alerts/src"/>
<classpathentry kind="src" output="adapters/adp3/bin" path="adapters/billing/src"/>
<classpathentry kind="src" output="adapters/adp4/bin" path="adapters/client/src"/>
<classpathentry kind="src" output="adapters/adp5/bin" path="adapters/category/src"/>
</classpath>
I want to read the value of path
where kind
is "src"
. I able to get all the path value but not able to imply condition over it. I am using the following code.
<target name="xml">
<echo>Test For Each</echo>
<for list="${classpath.classpathentry.path}" param="letter" delimiter=",">
<sequential>
<echo message="path ::: @{letter}"/>
</sequential>
</for>
</target>
It is working fine with all the path
values but what I should do to get the value of path
where kind
is "src"
?
As I stated in the comment, the following XSLT will parse all classpath entries of kind=src and generate a single line path statement.
getclasspath.xslt
Then the following ant task: