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

Re: 'Variable' question from Newbie

Subject: Re: 'Variable' question from Newbie
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Fri, 08 Nov 2002 22:42:36 +0100
for each select when xslt
Surla, Stacy wrote:
I have a collection of publications records in XML that store Discipline,
Title, Date, and other characteristics, including a flag indicating whether
the publication should show up on a Highlights page. I now want to output
the Highlights page, and I want the value of Discipline to be output only
once per group of records sharing that discipline. E.g.

That's a grouping problem. Look into the XSL FAQ for "grouping", or at http://www.jenitennison.com/xslt/grouping/index.html

Your groups are keyed by the Disciplines element. Think of
it as the following pseudo code:
  select first members of all groups
    output Discipline
    select all members of current group
      Output values of Title, Publisher, and Date

Some XSLT to get you started
  <xsl:key name="r-d" match="Record" use="Disciples"/>
  <xsl:template match="InstCorr">
    <xsl:for-each select="Record[
        generate-id()=generate-id(key('r-d',Disciples)]">
      <xsl:value-of select="Disciples"/>
      <xsl:for-each select="key('r-d',Disciples)">
        <xsl:value-of select="Title"/>
        ...
      </xsl:for-each>
    </xsl:for-each>
  </xsl:template>
(Beware: untested)

J.Pietschmann


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.