[Home] [By Thread] [By Date] [Recent Entries]
Chad Chelius wrote:
It depends. I assume you have something like
<Root>
<Story>
some content
</Story>
<Source>
some source stuff
</Source>
<Story>
some more content
</Story>
<Source>
some more source stuff
</Source>
<Root>
with one and only one Source element following a Story element.and you want this transformed into
<Root>
<Story>
some content
some source stuff
</Story>
<Story>
some more content
some more source stuff
</Story>
<Root>Then the following should work:
<xsl:template match="Story">
<Story>
<!-- first copy all original children of the Story element -->
<xsl:copy-of select="node()"/>
<!-- then copy all children of the following Source element -->
<xsl:copy-of select="following-sibling::Source[1]/node()"/>
</Story>
</xsl:template>
<!-- suppress Source elements -->
<xsl:template match="Source"/>
You'll need to process the Root element, and you may want to apply
other methods in order to suppress processing the original Source
elements.
And beware: the code above is completely untested.J.Pietschmann
|

Cart



