|
Subject: Re: [xsl] Subtree Transformation From: Abel Braaksma <abel.online@xxxxxxxxx> Date: Thu, 15 Mar 2007 13:04:02 +0100 |
I am wondering if it is possible to change a subtree of an XML tree whose structure is not always the same.
If the input would always look like this I would write a stylesheet that looks like the following:
<xsl:stylesheet match="/"> <a> <b> <xsl:copy-of="/a/b/c"/>
I need to copy everything and add some additional "<c>" tags. I dont't know how to do that becase with xsl:copy-of I can copy the whole tree but it can not be changed and if I iterate trough the tree with xsl:copy every tag is immideately closed. It would be nice if someone could help.
<xsl:template match="/> <xsl:apply-templates select="a" /> </xsl:template>
<xsl:template match="node() | @*" >
<xsl:copy>
<xsl:apply-templates select="node() | @*" />
</xsl:copy>
</xsl:template><!-- second, make additional 'c' nodes --> <c id="2" /> <c id="3" /> </xsl:template>
Cheers, -- Abel Braaksma
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] Subtree Transformation, Garvin Riensche | Thread | [xsl] XSLT2: Keys vs. xsl:choose to, Yves Forkl |
| Re: [xsl] fo spaces, Abel Braaksma | Date | SV: Re: [xsl] fo spaces, Mati Hadi |
| Month |