[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Removing Duplicates & Formatting
you'd probbaly better off doing this in two passes, first get the paths then elimiate duplicates. this uses saxon node-set extension to do two passes in one stylesheet, more or less every xslt engine (except mozilla) has a similar extension. <a> <b><c/><c/><d/></b> <b><d/></b> <c><d><e/></d></c> <c><d><e/></d></c> </a> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:saxon="http://icl.com/saxon" extension-element-prefixes="saxon" > <xsl:output method="xml" indent="yes" /> <xsl:key name="ref" match="elem" use="ref"/> <xsl:template match="/"> <xsl:variable name="x"> <xsl:for-each select="//*[not(*)]"> <p> <xsl:for-each select="ancestor-or-self::*" >/<xsl:value-of select="name()"/> </xsl:for-each> </p> </xsl:for-each> </xsl:variable> <xsl:copy-of select="saxon:node-set($x)/p[not(.=following-sibling::p)]"/> </xsl:template> </xsl:stylesheet> $ saxon path.xml path.xsl <?xml version="1.0" encoding="utf-8"?> <p>/a/b/c</p> <p>/a/b/d</p> <p>/a/c/d/e</p> -- http://www.dcarlisle.demon.co.uk/matthew ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|