Convert xml into simple file using xslt unix
Your XSLT doesn't quite produce the output you say you get, as it will also output lines for all job
elements directly under the root hudson
, like this..
"cedge" = ""
Additionally, when you match the job
element, you are not continuing processing by selecting any descendant job
elements of those, so the nested job
elements do not get picked up.
Probably the easiest thing to do is simply add a template that matches the document node \
and specifically select all the job elements you need (i.e the ones with nextBuildNumber
Try this XSLT
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text" /> <xsl:template match="/"> <xsl:apply-templates select="//job[nextBuildNumber]" /> </xsl:template> <xsl:template match="job"> <xsl:text>"</xsl:text> <xsl:value-of select="name"/> <xsl:text>" = "</xsl:text> <xsl:value-of select="nextBuildNumber"/> <xsl:text>" </xsl:text> </xsl:template> </xsl:stylesheet>