Johnny Ooi
Usenet Archive
- Joined
- Nov 3, 2004
- Messages
- 18
- Reaction score
- 0
I've written a template that does some work on a subtree, but I want to replace the subtree that I originally worked on. How would I do this?
Confused, Okay, here's an example:
<node>
<node>
<node>
</node>
<node>
</node>
</node>
<node> **
<node>
</node>
<node>
</node>
</node> **
</node>
This is a binary tree full of "node" tags. Let's let I was working on the subtree starting at the node tag I've indicated by the **s. Let's say I've done my work on the subtree and I want to replace the subtree in this master tree with the one I've just changed. I also want to change the top level node tag (for example, updating the attribute tag).
I can't do something like
<xsl:element>
<xsl:attribute counter="/node/@counter+1"/>
<xsl:copy-of select="/node/*[position=1]"/>
<xsl:copy-of select="$outputofsubtreework"/>
</xsl:element>
Because, while it will work in this case, I don't know in advance how many levels the tree will have.
Can anyone help me out here?
Johnny
Confused, Okay, here's an example:
<node>
<node>
<node>
</node>
<node>
</node>
</node>
<node> **
<node>
</node>
<node>
</node>
</node> **
</node>
This is a binary tree full of "node" tags. Let's let I was working on the subtree starting at the node tag I've indicated by the **s. Let's say I've done my work on the subtree and I want to replace the subtree in this master tree with the one I've just changed. I also want to change the top level node tag (for example, updating the attribute tag).
I can't do something like
<xsl:element>
<xsl:attribute counter="/node/@counter+1"/>
<xsl:copy-of select="/node/*[position=1]"/>
<xsl:copy-of select="$outputofsubtreework"/>
</xsl:element>
Because, while it will work in this case, I don't know in advance how many levels the tree will have.
Can anyone help me out here?
Johnny