Hi there,
I've created the following XSL stylesheet which takes an XML packet ( given to me from SVN ) and converts all the "entry" nodes, which don't include the text "archive", into a comma-separated list for my ANT script. An example XML file looks like this....
<?xml version="1.0"?>
<lists>
<list path="https://mydomain.com/branches">
<entry kind="dir">
<name>James_Work</name>
<commit revision="2209">
<author>James</author>
<date>2010-09-02T11:02:08.584250Z</date>
</commit>
</entry>
</list>
</lists>
... and my XSL is this ....
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" />
<xsl:variable name="selectionPropertyList">
<xsl:for-each select="lists/list/entry[name!='archive']">svnType/<xsl:value-of select="name" />
<xsl:if test="position()!=last()">,</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:template match="/">
<root>
<svnType><xsl:copy-of select="$selectionPropertyList" /></svnType>
</root>
</xsl:template>
</xsl:stylesheet>
The problem I'm hitting is when I get an empty packet back. This might happen for example if I call the SVN branches folder which is currently empty, and end up with an empty entry in my ANT listing.
An example XML packet looks like this
<?xml version="1.0"?>
<lists>
<list path="https://mydomain.com/branches">
</list>
</lists>
Does anyone know a way I could somehow filter out these empty packets from my listings?
Thanks, James
P.S. I've tried the tips given here but it doesn't quite match what I'm trying to do here. http://www.tek-tips.com/viewthread.cfm?qid=1088712&page=1