I've changed that to the following now:
<xsl:when test="action">
<xsl:apply-templates select="action"/>
</xsl:when>
unless you also moved the xsl:copy outside that is still going to give
you the problem that parents of action elements are not copied.
I don'tthink you want the xsl:choose at all.
Thanks to Dave Carlise's help, I now have the merge working as I wanted
it too. Dave, I did end up getting rid of the xsl:choose, I had in
the main template.
Anyway, I had to end up using a for loop to handle the output of the
forward elements the way I wanted too. For those that are intersted
here is the completed XSLT. Any way to shorten this or make it more
efficient would be appreciated.
This XSLT takes an struts-config.xml file, and merges it with an
external file that contains updates that need to be done to the action
elements and child forward elements.
XSLT Merge:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template
match="*|@*|comment()|processing-instruction()|text()">
<xsl:copy>
<xsl:apply-templates
select="*|@*|comment()|processing-instruction()|text()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="action-mappings/action">
<xsl:choose>
<xsl:when test="@path =
document('struts-config_new_variables01.xml')//action/@path">
<!-- Copy the value where @path = document()//action/@path -->
<xsl:variable name="pathvalue" select="@path"/>
<xsl:variable name="nodeset"
select="document('struts-config_new_variables01.xml')//action[(_at_)path =
$pathvalue]"/>
<xsl:element name="action">
<xsl:apply-templates select="$nodeset/@*"/>
<xsl:apply-templates select="$nodeset/forward"/>
<xsl:for-each select="./forward">
<xsl:if test="not(@name = $nodeset/forward/@name)">
<xsl:copy>
<xsl:apply-templates
select="*|@*|comment()|processing-instruction()|text()"/>
</xsl:copy>
</xsl:if>
</xsl:for-each>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:copy>
<xsl:apply-templates
select="*|@*|comment()|processing-instruction()|text()"/>
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="action/forward">
<xsl:copy>
<xsl:apply-templates
select="*|@*|comment()|processing-instruction()|text()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
=====
"The difference between fiction and reality is that fiction has to make
sense." - Tom Clancy
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list