Subject: Re: [xsl] output modified branch - best practice From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Mon, 21 Jun 2010 12:25:49 -0400 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:output method="xml" encoding="UTF-8" indent="yes"/> <xsl:strip-space elements="*"/>
<xsl:key name="k1" match="/root/update/data/*" use="node-name(.)"/>
<xsl:template match="/"> <xsl:apply-templates select="root/base/data"/> </xsl:template>
<xsl:template match="/root/base/data"> <xsl:copy> <xsl:apply-templates/> </xsl:copy> </xsl:template>
<xsl:template match="/root/base/data/*"> <xsl:variable name="var.update" select="key('k1', node-name(.))"/> <xsl:choose> <xsl:when test="exists($var.update)"> <xsl:copy-of select="$var.update"/> </xsl:when> <xsl:otherwise> <xsl:copy-of select="."/> </xsl:otherwise> </xsl:choose> </xsl:template>
</xsl:stylesheet>
Cheers, Wendell
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] output modified branch - , Martin Honnen | Thread | [xsl] rather tricky numbering probl, a kusa |
Re: [xsl] XML tags as map keys and , Wendell Piez | Date | [xsl] rather tricky numbering probl, a kusa |
Month |