[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: From filepaths to XML hierarchy

Subject: Re: From filepaths to XML hierarchy
From: Jesper Tverskov <jesper@xxxxxxxxxxx>
Date: Tue, 27 Dec 2011 15:01:22 +0100
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/

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.