Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: rearranging xmls tructure depending on sub object [Thread Next] Re: rearranging xmls tructure depending on sub objectTo: NULL Date: 8/25/2009 9:28:00 AM On 25 Aug, 18:10, Martin Honnen <mahotr...@yahoo.de> wrote: > erik wrote: > > On 25 Aug, 16:06, Martin Honnen <mahotr...@yahoo.de> wrote: > >> It is a grouping problem that can be solved in XSLT 2.0 with > >> xsl:for-each-group and with XSLT 1.0 using Muenchian grouping. > >> Do you use or want to use XSLT 2.0 or 1.0? 2.0 is available with Saxon= 9 > >> or with AltovaXML tools or with XML editors like Oxygen or Altova XML > >> Spy or Stylus Studio, XSLT 1.0 is available with Microsoft MSXML 3 and > >> later and with .NET's XslCompiledTransform. > >> Let us know which version you use/want to use. > > As long as I can incorporate it in my wcf service (dotnet 3.5 C# > > project) it doesn't matter. I'm grateful for any solution to this > > problem. > > Here is an XSLT 2.0 stylesheet: > > <xsl:stylesheet > =A0 =A0xmlns:xsl=3D"http://www.w3.org/1999/XSL/Transform" > =A0 =A0version=3D"2.0"> > > =A0 =A0<xsl:output indent=3D"yes"/> > =A0 =A0<xsl:strip-space elements=3D"*"/> > > =A0 =A0<xsl:template match=3D"ArrayOfWorkShift"> > =A0 =A0 =A0<Array> > =A0 =A0 =A0 =A0<xsl:for-each-group select=3D"WorkShift" group-by=3D"Perso= n/Name"> > =A0 =A0 =A0 =A0 =A0<Person> > =A0 =A0 =A0 =A0 =A0 =A0<xsl:copy-of select=3D"Person/Name"/> > =A0 =A0 =A0 =A0 =A0 =A0<xsl:for-each-group select=3D"current-group()" > group-by=3D"WorkPlace/Id"> > =A0 =A0 =A0 =A0 =A0 =A0 =A0<xsl:sort select=3D"WorkPlace/Id" data-type=3D= "number"/> > =A0 =A0 =A0 =A0 =A0 =A0 =A0<WorkPlace> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0<xsl:copy-of select=3D"WorkPlace/Id"/> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0<xsl:for-each select=3D"current-group()"> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0<WorkShift> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0<xsl:copy-of select=3D"StartTime, = EndTime"/> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0</WorkShift> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0</xsl:for-each> > =A0 =A0 =A0 =A0 =A0 =A0 =A0</WorkPlace> > =A0 =A0 =A0 =A0 =A0 =A0</xsl:for-each-group> > =A0 =A0 =A0 =A0 =A0</Person> > =A0 =A0 =A0 =A0</xsl:for-each-group> > =A0 =A0 =A0</Array> > =A0 =A0</xsl:template> > > </xsl:stylesheet> > > To use that within a .NET application you need to install Saxon 9 fromhtt= p://saxon.sourceforge.net/. It has lots of documentation, in additionhttp:/= /www.xmlplease.com/saxonaspnetmight be of help for a quick start. > > -- > > =A0 =A0 =A0 =A0 Martin Honnen --- MVP XML > =A0 =A0 =A0 =A0http://msmvps.com/blogs/martin_honnen/ Thank you very, very much! /Erik | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
