|
Subject: RE: [xsl] Add namespace to element name itself From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Tue, 18 Nov 2008 12:02:45 -0000 |
Use
<xsl:element name="prefix:{local-name()}" namespace="uri">
where prefix and uri are your desired namespace prefix and namespace URI
respectively.
Michael Kay
http://www.saxonica.com/
> -----Original Message-----
> From: V.Ramkumar [mailto:v.ramkumar@xxxxxxxxxxxxxxxxxxxxxx]
> Sent: 18 November 2008 11:58
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Add namespace to element name itself
>
> Hi List,
>
> I am doing XML to XML Transformation using saxon9.
>
> I have to add namespace to output XML name itself in transformation.
>
> Not like, <pii xmlns="ce"> - This example found in list
>
> I need like this <ce:pii>.
>
> My input XML contains,
> <item-info>
> <jid>YFMIC</jid>
> <aid>1120</aid>
> <pii>S0740-0020(08)00080-4</pii>
> <doi>10.1016/j.fm.2008.04.010</doi>
> <copyright type="unknown" year="2008"/>
> </item-info>
>
> Required output XML,
> <item-info>
> <jid>YFMIC</jid>
> <aid>1120</aid>
> <ce:pii>S0740-0020(08)00080-4</ce:pii>
> <ce:doi>10.1016/j.fm.2008.04.010</ce:doi>
> <ce:copyright type="unknown" year="2008"/>
> </item-info>
>
> My XSL:
> <xsl:template match="*">
> <xsl:copy>
> <xsl:copy-of select="@*"/>
> <xsl:apply-templates/>
> </xsl:copy>
> </xsl:template>
>
> <xsl:template match="pii" priority="3">
> <xsl:element name="{local-name()}" namespace="ce">
> <xsl:apply-templates select="@*|node()" />
> </xsl:element>
> </xsl:template>
> ect..
> </xsl:template>
>
> Regards,
> Ramkumar
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] Add namespace to element name, V.Ramkumar | Thread | RE: [xsl] Add namespace to element , V.Ramkumar |
| [xsl] Add namespace to element name, V.Ramkumar | Date | RE: [xsl] Add namespace to element , V.Ramkumar |
| Month |