Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Transform fields to node attributes? >Thread Next - Re: Transform fields to node attributes? Re: Transform fields to node attributes?To: NULL Date: 1/3/2009 2:17:00 PM Savvoulidis Iordanis wrote:
> How do I transform the following XML :
> <Event code="100 ">
> <Status>FINAL</Status>
> <League>AGK</League>
> <Date>10/11/2008</Date>
> <Time>21:45</Time>
> </Event>
>
> to the one below:
>
> <Event code="100 " Status="FINAL" League="AGK" Date="10/11/2008"
> Time="21:45" />
Here is a stylesheet:
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="Event">
<xsl:copy>
<xsl:apply-templates select="@* | *[not(*)]"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@*">
<xsl:copy/>
</xsl:template>
<xsl:template match="Event/*[not(*)]">
<xsl:attribute name="{name()}" namespace="{namespace-uri()}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
