Hi Darius You want to use identity template to copy through everything. Then have a template which matches the ones you want removed which simply outputs nothing. The more specific match will override the general one. Something like the following will work:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl" version="1.0"><xsl:output method="xml"/> <xsl:template match="/"> <xsl:apply-templates /> </xsl:template> <!-- Default is copy all nodes --> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <!-- Except ....--> <xsl:template match="concept[remove]" /> </xsl:stylesheet> Note this matches any concept which has a <remove> child. You could be more specific with something like: <xsl:template match="concept[remove/@apply='true']" /> which matches your description, or any other condition you like. Cheers Bob On 8 August 2011 15:50, Darius Jazayeri <[email protected]> wrote: > Hey Burke, > I am having a lot of trouble with what I assumed would be a straightforward > application of XSLT, and I haven't been able to find an example of this on > the web. Can you help me out here? The contrived simplified version is: > I want to remove any concept that has a <remove> tag as a child, and pass > through all other tags exactly as they are. (More realistically I want to > only do so if some further condition holds for its attributes, but that > should be easy if I can figure out how to pass everything through that > doesn't match my main translation.) > Example source: > <concepts> > <concept id="1"/> > <concept id="2"/> > <concept id="3"/> > <remove apply="true"/> > </concept> > <concept id="4"/> > </concepts> > Desired output > <concepts> > <concept id="1"/> > <concept id="2"/> > <concept id="4"/> > </concepts> > Thoughts? > -Darius > ________________________________ > Click here to unsubscribe from OpenMRS Developers' mailing list _________________________________________ To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to [email protected] with "SIGNOFF openmrs-devel-l" in the body (not the subject) of your e-mail. [mailto:[email protected]?body=SIGNOFF%20openmrs-devel-l]

