[Home] [By Thread] [By Date] [Recent Entries]
On 7/4/07, Michael Eberhard <michael_eberhard@xxxxxx> wrote:
Hi, Use the identity transform with a no-op template for each of conditions where you don't want to copy the input to the result. The tricky part of looking up the <MainElement> from the <ExtElement> can be done using a key: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:param name="max" select="'20'"/> <xsl:key name="mainElem-by-id" match="MainElement" use="@id"/> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="MainElement[@val > $max]"/> <xsl:template match="ExtElement[key('mainElem-by-id', @mid)/@val > $max]"/> </xsl:stylesheet> generates: <MainElement id="0" val="10"/> <MainElement id="1" val="20"/> <ExtElement mid="0"/> <ExtElement mid="0"/> <ExtElement mid="1"/> cheers andrew -- http://andrewjwelch.com
|

Cart



