Subject:XML to XML Author:Robert Nordin Date:18 Nov 2005 06:43 AM
Hello everybody... this is my first post...
i am new to XSL.. and I have a problem that I cannot solve. I have searched and searched for an answer but none targets my problem exactly... or at least I cannot get it to work.
Now... my proble is that I am supposed to transform this into another XML. The new XML should skip the <clan> tag and the <children> tag and move the tags within <children> into the <our_children> tag. I cannot get this to work.
<!-- this template replaces the empty our_children node
with one full of kids -->
<xsl:template match="our_children">
<our_children>
<!-- have the kids move in with us -->
<xsl:copy-of select="../../children/*"/>
</our_children>
</xsl:template>
<!-- this template prevents the old children from
being copied, ie it deletes the old children nodes -->
<xsl:template match="children"/>
<!-- this template replaces the empty our_children node with one full of kids -->
<xsl:template match="våra_barn">
<våra_barn>
<!-- have the kids move in with us -->
<xsl:copy-of select="../../barn/*"/>
</våra_barn>
</xsl:template>
<!-- this template prevents the old children from being copied, ie it deletes the old children nodes -->
<xsl:template match="barn"/>
</xsl:stylesheet>
If I added the select="node()|@*" to the first template it works... :-)