[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] for-each-group in xslt 2.0


Subject: RE: [xsl] for-each-group in xslt 2.0
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 29 Mar 2006 12:45:50 +0100

> if i use 
> <xsl:for-each-group select="." group-by="Application">
> 
> i got the correct result.

Well, only you can judge correctness, because only you know what you were
trying to achieve, but this construct looks very implausible:

* select="." selects a single item: why would you want to partition a
singleton set into subsets?

* group-by="Application" uses a grouping key consisting entirely of white
space, since the Application element contains no descendant text nodes.

Michael Kay
http://www.saxonica.com/

> 
> regards,
> Arul
> --- Dimitre Novatchev <dnovatchev@xxxxxxxxx> wrote:
> 
> > > I try to get the Application name. but i didnt get
> > any
> > > ouptut..
> > > what is wrong here?
> > 
> > The xsl:for-each-group instruction:
> > 
> > >          <xsl:for-each-group select="Application"
> > > group-by="Application">
> > 
> > will not select anything, because in your source xml
> > document an
> > "Application" element does not have "Application"
> > children.
> > 
> > 
> > --
> > Cheers,
> > Dimitre Novatchev
> > ---------------------------------------
> > Truly great madness cannot be achieved without
> > significant intelligence.
> > 
> > 
> > On 3/29/06, Arulraj <p_arulraj@xxxxxxxxx> wrote:
> > > Hello List,
> > >
> > > I am using the following XML input sequence,
> > >  <?xml version="1.0" encoding="UTF-8"?>
> > >  <layout>
> > >      <Application name="odcs2web">
> > >          <Processgroup name="FSRenta">
> > >              <Process name="sample">
> > >                  <PanelName
> > name="H2WSearchLayout"/>
> > >                  <PanelName
> > name="H2WListAllLayout"/>
> > >                  <PanelName name="H2WEditLayout"/>
> > >                  <PanelName name="H2WNewLayout"/>
> > >              </Process>
> > >              <Process name="sampleflowinfo">
> > >                  <PanelName
> > name="H2WListFlowInfo"/>
> > >                  <PanelName
> > name="H2WAddFlowInfo"/>
> > >                  <PanelName
> > name="H2WUpdFlowInfo"/>
> > >                  <PanelName
> > name="H2WDelFlowInfo"/>
> > >              </Process>
> > >          </Processgroup>
> > >      </Application>
> > >      <Application name="bvwinfo">
> > >          <Processgroup name="bvwinfogrp">
> > >              <Process name="bvw1">
> > >                  <PanelName name="screen1"/>
> > >              </Process>
> > >              <Process name="bvw2">
> > >                  <PanelName name="screen2"/>
> > >              </Process>
> > >          </Processgroup>
> > >      </Application>
> > >  </layout>
> > >
> > >  And XSLT.. i have the following code.
> > >
> > >  <?xml version="1.0" encoding="ISO-8859-1"?>
> > >  <xsl:stylesheet version="2.0"
> > > xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> > >      <xsl:template match="layout">
> > >          <xsl:for-each-group select="Application"
> > > group-by="Application">
> > >                  <xsl:value-of
> > > select="current-group()/@name"/>
> > >          </xsl:for-each-group>
> > >        </xsl:template>
> > >
> > > I try to get the Application name. but i didnt get
> > any
> > > ouptut..
> > > what is wrong here?
> > >
> > > regards,
> > > Arul
> > >
> > >
> > >
> > >
> >
> __________________________________________________________
> > > Yahoo! India Matrimony: Find your partner now. Go
> > to http://yahoo.shaadi.com
> > 
> > 
> 
> 
> 
> 		
> __________________________________________________________ 
> Yahoo! India Matrimony: Find your partner now. Go to 
> http://yahoo.shaadi.com


Current Thread
Keywords
xml