[
Lists Home |
Date Index |
Thread Index
]
If you had simplified your code to demonstrate the essence of the
problem you would surely have spotted the bug very quickly:
<xsl:template match="GrantNet">
<xsl:apply-templates select="GrantNet[generate-id(.) =
generate-id(key('rows', fldCatID)[1])]"/>
The GrantNet element does not have any GrantNet children. Any grouping
of the GrantNet elements must be done in the template rule for their
common parent.
Michael Kay
> -----Original Message-----
> From: puja thakral [mailto:puja_thakral@yahoo.com]
> Sent: 20 October 2003 18:16
> To: List; xml
> Subject: [xml-dev] Grouping Problem
>
>
> Hi Everyone,
> I'm little stuck in a grouping problem.I'm sure
> someone can help me on this list.This list has really
> been very supportive.Thanks for all the help.
>
> Here is my XML document,
> <?xml version="1.0" encoding="UTF-8"?>
> <?xml-stylesheet type="text/xsl" href="example1.xsl"?>
> <dataroot
> xmlns:od="urn:schemas-microsoft-com:officedata"
> generated="2003-10-15T12:22:08">
> <GrantNet>
> <Issue_x0020_Number>0005</Issue_x0020_Number>
> <Handout_x0020_Number>111</Handout_x0020_Number>
> <fldCatID>GS</fldCatID>
> <fldSponsorDesc>American Association of University
> Women</fldSponsorDesc>
> <Program>2000-2001 American Fellowships</Program>
> <URL>http://www.aauw.org/3000/fdnfelgra.html</URL>
> <Description></Description>
> <Deadline_x0020_Date>1999-11-15T00:00:00</Deadline_x0020_Date>
> <Program_x0020_Source>Web</Program_x0020_Source>
> <Date_x0020_of_x0020_Notice>1999-10-11T00:00:00</Date_x0020_of
> _x0020_Notice>
> </GrantNet>
>
> <GrantNet>
> <Issue_x0020_Number>0103</Issue_x0020_Number>
> <Handout_x0020_Number>752</Handout_x0020_Number>
> <fldCatID>ID</fldCatID>
> <fldSponsorDesc>American Council of Learned
> Societies</fldSponsorDesc>
> <Program>Library of Congress Fellowships in
> International Studies</Program>
> <URL>http://www.acls.org</URL>
> <Description></Description>
> <Deadline_x0020_Date>2000-10-02T00:00:00</Deadline_x0020_Date>
> <Program_x0020_Source>Mailing from
> Sponsor</Program_x0020_Source>
> <Date_x0020_of_x0020_Notice>2000-08-25T00:00:00</Date_x0020_of
> _x0020_Notice>
> </GrantNet>
>
> <GrantNet>
> <Issue_x0020_Number>0103</Issue_x0020_Number>
> <Handout_x0020_Number>753</Handout_x0020_Number>
> <fldCatID>ID</fldCatID>
> <fldSponsorDesc>American Council of Learned
> Societies</fldSponsorDesc>
> <Program>Contemplative Practice Fellowships</Program>
> <URL>http://www.acls.org</URL>
> <Description></Description>
> <Deadline_x0020_Date>2000-11-01T00:00:00</Deadline_x0020_Date>
> <Program_x0020_Source>Mailing from
> Sponsor</Program_x0020_Source>
> </GrantNet>
>
> <GrantNet>
> <Issue_x0020_Number>0101</Issue_x0020_Number>
> <Handout_x0020_Number>606</Handout_x0020_Number>
> <fldCatID>SB</fldCatID>
> <fldSponsorDesc>A.L. Mailman Family Foundation,
> Inc.</fldSponsorDesc>
> <Program>Foundation Grants</Program>
> <URL>http://www.mailman.org</URL>
> <Description></Description>
> <Deadline_x0020_Date>2001-01-15T00:00:00</Deadline_x0020_Date>
> <Program_x0020_Source>Other</Program_x0020_Source>
> <Date_x0020_of_x0020_Notice>2000-06-26T00:00:00</Date_x0020_of
> _x0020_Notice>
> </GrantNet>
> </dataroot>
>
> My XSL is
> <?xml version='1.0' encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:fo="http://www.w3.org/1999/XSL/Format"
> xmlns:xlink="http://www.w3.org/1999/xlink"
> xmlns="http://www.w3.org/TR/REC-html40">
>
> <xsl:key name="rows" match="GrantNet" use="fldCatID"
> />
>
> <xsl:output method ="html"/>
>
> <xsl:template match="dataroot">
> <HTML>
> <HEAD>
> <TITLE>GrantNet</TITLE>
> </HEAD>
> <BODY>
> <A NAME="TOP"/>
> <h2 align="center"><font color="#800000">Office Of
> Research and Sponsored Programs<BR/><BR/>GrantNet
> Month 2003</font></h2><BR/>
> <p align="left"><font color="#004080" face="Times New
> Roman"><a name="Sorted by Disciplines"><big>Sorted by
> Disciplines</big></a></font> </p>
>
> <p align="left"><font face="Times New Roman">
> <a href="#fldCatID"><big>AH - Arts &
> Humanities</big></a><br/>
> <a href="#fldCatID"><big>ED - Education</big></a><br/>
> <a href="#fldCatID"><big>GS - Graduate Student
> </big></a><br/>
> <a href="#fldCatID"><big>HM - Health &
> Medicine</big></a><br/>
> <a href="#fldCatID"><big>ID -
> Interdisciplinary</big></a><br/>
> <a href="#fldCatID"><big>IN - International
> Programs</big></a><br/>
> <a href="#fldCatID"><big>SB - Social and Behavioral
> </big></a><br/>
> <a href="#fldCatID"><big>SEM - Science, Engineering
> & Math<br/>
> </big></a></font> </p>
> <xsl:apply-templates/>
>
> </BODY>
> </HTML>
> </xsl:template>
>
> <xsl:template match="GrantNet">
> <xsl:apply-templates select="GrantNet[generate-id(.) =
> generate-id(key('rows', fldCatID)[1])]"/>
>
> <xsl:apply-templates select="fldCatID"/>-
> <B><xsl:apply-templates
> select="Handout_x0020_Number"/></B><br/>
> <font color="#0000FF"><xsl:apply-templates
> select="fldSponsorDesc"/></font><br/>
> <B><U><xsl:apply-templates
> select="Program"/></U></B><br/><br/>
> <xsl:apply-templates
> select="Description"/><br/><br/>
>
> <P><I><font color="#0000FF">
> <A TARGET="_blank">
> <xsl:attribute name="HREF">
> <xsl:apply-templates select="URL"/>
> </xsl:attribute>
> <xsl:apply-templates select="URL"/>
> </A>
> </font>
> </I><br/></P>
>
> <xsl:apply-templates
> select="Deadline_x0020_Date"/><br/>
>
> <br/><hr/><p><center>[<a
> href="#TOP">TOP</a>]</center></p><hr/>
>
> </xsl:template>
>
> </xsl:stylesheet>
>
> I'm trying to group it by fldCatID but nothing seems
> to heppen.I tried using
> <xsl:apply-templates select="GrantNet[generate-id(.) =
> generate-id(key('rows', fldCatID)[1])]"/>
> but looks like I'm missing something.
>
> Any help is appreciated a lot.Thanks in advance.
> Regards,
> Puja.
>
>
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Shopping - with improved product search
> http://shopping.yahoo.com
>
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
>
> The list archives are at http://lists.xml.org/archives/xml-dev/
>
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://lists.xml.org/ob/adm.pl>
>
|