Hi,
Look at the recursive copy template. You can start with
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
and add another template to process author-group differently, by
creating the authors element and copying there the author elements, then
copy the rest of the nodes:
<xsl:template match="author-group">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<authors>
<xsl:apply-templates select="author"/>
</authors>
<xsl:apply-templates select="node()[not(self::author)]"/>
</xsl:copy>
</xsl:template>
P.S. Note that your input is not wellformed, you need
<sup>wkqwj</sup> instead of <sup>wkqwj<sup>.
Best Regards,
George
--
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
arut che wrote:
Hi all,
I am new to appl xslt/xml conversion,
I want to club multiple elements to a cluster and become childs of a
new parent element.
Input is :
<author-group>
<author>
<given-name>A.N.</given-name>
<surname>Chiardfsf</surname>
<cross-ref refid="aff1">
<sup>a</sup>
</cross-ref>
<cross-ref refid="cor1">
<sup>wkqwj<sup>
</cross-ref>
<e-address type="email">asd(_at_)alsdfgs(_dot_)sd</e-address>
</author>
<author>
<given-name>L.J.</given-name>
<surname>Tfwqqf</surname>
<cross-ref refid="aff1">
<sup>a</sup>
</cross-ref>
</author>
<author>
<given-name>W.F.</given-name>
<surname>Eqwfq</surname>
<cross-ref refid="aff2">
<sup>b</sup>
</cross-ref>
</author>
<affiliation id="aff1">
<label>a</label>
<textfn>zsg Divisionsdfgsfg, sgs</textfn>
</affiliation>
<affiliation id="aff2">
<label>b</label>
<textfn>DGD, USA</textfn>
</affiliation>
<correspondence id="cor1">
<label>rewt</label>
<text>Corresponding author. Tel:MKKWE W QWQWE</text>
</correspondence>
</author-group>
I want to club all "author" elements and need to placed under a parent
"authors" as follows:
required output:
<author-group>
<authors>
<author>
<given-name>A.N.</given-name>
<surname>Chiardfsf</surname>
<cross-ref refid="aff1">
<sup>a</sup>
</cross-ref>
<cross-ref refid="cor1">
<sup>wkqwj<sup>
</cross-ref>
<e-address type="email">asd(_at_)alsdfgs(_dot_)sd</e-address>
</author>
<author>
<given-name>L.J.</given-name>
<surname>Tfwqqf</surname>
<cross-ref refid="aff1">
<sup>a</sup>
</cross-ref>
</author>
<author>
<given-name>W.F.</given-name>
<surname>Eqwfq</surname>
<cross-ref refid="aff2">
<sup>b</sup>
</cross-ref>
</author>
</authors>
<affiliation id="aff1">
<label>a</label>
<textfn>zsg Divisionsdfgsfg, sgs</textfn>
</affiliation>
<affiliation id="aff2">
<label>b</label>
<textfn>DGD, USA</textfn>
</affiliation>
<correspondence id="cor1">
<label>rewt</label>
<text>Corresponding author. Tel:MKKWE W QWQWE</text>
</correspondence>
</author-group>
Regards
Aruthce
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--