Subject: RE: Can you break one node tree into two?
From: "Wilde Rebecca L SSgt HQ SSG/STS" <Rebecca.Wilde@xxxxxxxxxxxxx>
Date: Tue, 1 Feb 2005 10:52:20 -0600
|
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
|