tgreer 189 Made Her Cry Team Colleague

Since it's been about three years since I had to write any XSLT, I'd like some assistance with the code below.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  version="2.0">
<xsl:output method="text"/>
<xsl:template match="/">

<xsl:for-each select="/WatchConfig/ProcessList/Process/Node">
<xsl:if test="Plugin = 'PWScript'">
<xsl:text>
</xsl:text>
<xsl:value-of select="Config" disable-output-escaping="yes" />
<xsl:text>
************************************************************************
</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

The code above works fine. It outputs the value of the Config element, a child of /WatchConfig/ProcessList/Process/Node, when the "Plugin" sibling value equals "PWScript". In other words, Node contains Config and Plugin, and when Plugin = PWScript, output the value of Config. So far so good.

However, sometimes the Node element contains another Node Element, and I want to perform the same operation on that Node. And so on, deeper and deeper:

/WatchConfig/ProcessList/Process/Node
/WatchConfig/ProcessList/Process/Node/Node
/WatchConfig/ProcessList/Process/Node/Node/Node

I suspect I need to have an IF for "Node" and then call a function recursively.

I've forgotten how. :)

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.