Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Change one xml schema to another using XSLT? >Thread Next - Re: Change one xml schema to another using XSLT? Re: Change one xml schema to another using XSLT?To: NULL Date: 3/2/2006 11:13:00 PM This'll do it:-
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8" />
<xsl:key name="sections" match="section" use="." />
<xsl:template match="root">
<xsl:for-each select="//section[count(key('sections', .)[1] | .) = 1]">
<section>
<name><xsl:value-of select="." /></name>
<xsl:apply-templates select="//book[section=current()]" />
</section>
</xsl:for-each>
</xsl:template>
<xsl:template match="book">
<book>
<xsl:copy-of select="*[local-name() != 'section']" />
</book>
</xsl:template>
</xsl:stylesheet>
Anthony
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
