[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: From filepaths to XML hierarchy
That's it! Thanks. This is the kind of solution I would love to be able to do on the fly without having to think about it. I'm not there yet. On Tue, Dec 27, 2011 at 2:50 PM, Martin Honnen <Martin.Honnen@xxxxxx> wrote: > Jesper Tverskov wrote: > >> Let us reduce the problem to the following input file: >> <x> >> B B <a><b><c/></b></a> >> B B <a><b><d/></b></a> >> B B <a><b><e/></b></a> >> B B <h><i/></h> >> B B <h><j/></h> >> </x> >> >> How can I transform it into the following output: >> <x> >> B B <a><b><c/><d/><e/></b></a> >> B B <h><i/><j/></h> >> </x> > > > Try > > <xsl:stylesheet > B xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > B version="2.0"> > > B <xsl:template match="*"> > B B <xsl:param name="group" select="*"/> > B B <xsl:copy> > B B B <xsl:for-each-group select="$group" group-by="node-name(.)"> > B B B B <xsl:apply-templates select="."> > B B B B B <xsl:with-param name="group" select="current-group()/*"/> > B B B B </xsl:apply-templates> > B B B </xsl:for-each-group> > B B </xsl:copy> > B </xsl:template> > > </xsl:stylesheet> > > although I am not sure I have understood completely what you want to > achieve. > > > -- > > B B B B Martin Honnen --- MVP Data Platform Development > B B B B http://msmvps.com/blogs/martin_honnen/
|
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
|