This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: XML to XML Transformation


> I'm looking to write a style sheet that will perform an XML to XML
> transformation.  My requirements are not too complex and I don't think
> this should be very difficult.  I simply want to take an XML document
> where an element has an attribute that acts as a yes/no flag.  I would
> like to filter only the "yes" flags and render a new XML page
> with only
> the elements that contain the "yes" flag in the attribute value.

You don't say whether the elements with "yes/no" flags can be nested, which
makes quite a difference to the solution. Assuming they can't, and that
you're only interested in the E elements, and that these all have the flag
present, I would write it as:

<xsl:template match="E[@flag='yes']">
<xsl:copy-of select="."/>
</xsl:template>

<xsl:template match="E[@flag='no']"/>

Mike Kay


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]