xsl-list
[Top] [All Lists]

RE: Can you break one node tree into two?

2005-02-01 09:52:20

Thank you for all the responses!  Working with those I was able to come
up with and was able to get to work:

<xsl:template match="RootEle">
        <xsl:if test="*/Address">
                <xsl:copy>
                        <xsl:apply-templates mode="Addressing"/>
                </xsl:copy>
        </xsl:if>
        <xsl:copy>
                <xsl:apply-templates mode="Message"/>
        </xsl:copy>
</xsl:template>

<xsl:template match="RootEle/*" mode="Addressing">
        <xsl:variable name="a" select="Address"/>
        <xsl:copy>
                <xsl:copy-of select="$a | $a/preceding-sibling::*"/>
        </xsl:copy>
</xsl:template>

<xsl:template match="RootEle/*" mode="Message">
        <xsl:variable name="b" select="Address"/>
        <xsl:choose>
                <xsl:when test="$b">
                        <xsl:copy>
                                <xsl:copy-of
select="$b/following-sibling::*"/>
                        </xsl:copy>
                </xsl:when>
                <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
        </xsl:choose>           
</xsl:template>

This will take into account if I did not get an "Address" node as well
as not force me to know what any node is besides the "RootEle" and
"Address".

Thank you all for the help.  Now I just have to see how well I can
continue to tweak.

Becky

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>
  • RE: Can you break one node tree into two?, Wilde Rebecca L SSgt HQ SSG/STS <=