|
|
 |
| XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the XSLT section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

June 26th, 2009, 12:03 PM
|
|
Registered User
|
|
Join Date: Jun 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
How do you Show a Heading Only Once?
Dear All
I've done a bit of XSLT in the past but this one has got me stumped!
I've got some XML that looks like
Code:
<ArrayOfBrew xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Brew>
<Abstract>The composition of beer is discussed in the context of human nutrition and health. It is pointed out that beer contains a relatively moderate concentration of alcohol, a large quantity of water, significant quantities of carbohydrate (but very little of it in the form of free sugar), no fat, some small peptides (but little full sized protein or free amino acids) and a range of trace nutrients including several vitamins (particularly members of the B group) and minerals (particularly silicon, magnesium and potassium, but little sodium). Furthermore, two other groups of beer constituents, namely the flavonoids and the melanoidins, have antioxidant properties which are thought to be of value in the prevention of various diseases. Melanoidins, which are formed in malt during kilning and roasting, are found in higher concentrations in dark beers brewed using roasted or intensively kilned malts. Hop bitter substances have antibacterial effects which prevent pathogens from proliferating (helping to make it safe to drink beer in situations where clean drinking water is unavailable) and some other hop constituents are reported to have cancer inhibiting properties under laboratory conditions.</Abstract>
<Author>Baxter, D.</Author>
<Bibliography>Brussels, 1999, 1-6.</Bibliography>
<BulletinNumber>106807</BulletinNumber>
<Language />
<Keywords>
<Keyword>
<Description>beer</Description>
</Keyword>
<Keyword>
<Description>composition</Description>
</Keyword>
<Keyword>
<Description>survey</Description>
</Keyword>
<Keyword>
<Description>properties</Description>
</Keyword>
<Keyword>
<Description>nutrition</Description>
</Keyword>
<Keyword>
<Description>health</Description>
</Keyword>
</Keywords>
<PublicationYear>1999</PublicationYear>
<Source>Beer Health Symp.</Source>
<SubjectCode>U638</SubjectCode>
<Title>HEALTHY INGREDIENTS IN BEER.</Title>
</Brew>
and my XSLT looks like this at the moment
Code:
<xsl:template match="ArrayOfBrew">
<xsl:apply-templates>
<xsl:sort select="SubjectCode"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="Brew">
Subject <xsl:apply-templates select="SubjectCode"/><br/>
Title <xsl:apply-templates select="Title"/><br/>
Authors <xsl:apply-templates select="Author"/><br/>
Source <xsl:apply-templates select="Source"/><br/>
BIO <xsl:apply-templates select="Bibliography"/><br/><br/>
Abstract <xsl:apply-templates select="Abstract"/><br/>
Keywords:
<xsl:for-each select="Keywords">
<xsl:for-each select="Keyword">
<xsl:value-of select="Description" />,
</xsl:for-each>
</xsl:for-each>
<br/><br/>
<xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>
My SubjectCode is to be a heading, and i have sorted so that have them grouped together but it of course each record has one . Without using xslt 2 ( I'm just using ie 7 at the moment) is there a way to get the output like this. ( Ie only show the Subject Code for the first record of each group)
Subject A001
Title 1988 ANNUAL STATISTICAL STUDY.
Authors Finnegan, T.
Source Mod. Brew. Age
BIO March 1989, 40(11), Cover page, 2-4, 6-8, 12-16, 18-22.
Abstract US domestic and imported beer sales totalled 190,798,000 barrels in 1988, a 0.09% increase on 1987. Beer imports rose 0.4% above the 1987 level, with the Netherlands and Mexico in the lead. Sales, market share, brand development, marketing and important personnel changes are reviewed for the 10 leading US breweries, (Anheuser-Busch, Miller, Stroh, Coors, G. Heileman, Pabst, Genesee, Falstaff, Latrobe, Hudepohl-Schoenling). The impact of scheduled health warning labels on beer, pending imposition of increased excise tax and advertising bans are discussed. Relevant new studies on alcohol and health are cited. Comparative 1988/1987 statistics are presented for: US total beer sales; barrelage of top 10 brewers (5 brewers); top domestic brewers; top 26 US commercial brewers as well as statistics/graphs for: 1988 market share of top 5 brewers; top six brewers volume development 1978 to 1988, US per capita consumption of malted beverages 1974 to 1988; a 10 year comparison of top 10 US brewers; domestic market share of top 5 brewers for 1968, 1978, 1988; 1988 US beer imports, withdrawls and per capita consumption of malt beverages 1981 to 1988; world beer production 1985 to 1987; production of malt beverages in the US 1908 to 1988; barrelage of leading US brewers 1968 to 1988; production, draught, packaged sales and total tax paid withdrawls of malt beverages 1939 to 1988; barrelage of top 5 breweries 1977 to 1988; domestic market share of top 5 brewers 1978 to 1988.
Keywords: beer, production, marketing, survey, brand, brewery, import, statistics, brewing industry,
Title FUTURE-PROOFING THE SECTOR.
Authors Long, D.
Source Brew. Distill.
BIO Feb. 2005, 1(2), 46-51.
Abstract The activities of the British Beer and Pub Association (BBPA) as the representative body of the UK brewing industry and public house trade, particularly in connection with politics, legislation and related matters, are described, including the ongoing campaign for a reduction (or at least an end to further increases) in the UK excise duty on beer, the promotion of beer consumption through measures to improve quality (especially in the pub trade, e.g. through the provision of training in the correct storage, handling and dispensing of draught beer), efforts to counter the propaganda of the anti alcohol lobby while encouraging safe and sociable drinking habits and reminding politicians, etc., of the fact that while ill health associated with long term habitual excessive alcohol intake and antisocial behaviour induced or aggravated by drunkenness are real and sometimes serious problems, the persons concerned are an unrepresentative minority of alcoholic beverage consumers (whereas most of those who drink beer, or any other alcoholic beverage, do so in reasonable moderation, without harming themselves or anyone else thereby), supporting research into the influence of alcoholic beverages on health and drawing attention to the evidence for possible beneficial effects of regular moderate beer consumption, developing methods and procedures to facilitate (and reduce the cost of) compliance with UK and European legislation on matters such as food safety and environmental protection by the brewing industry and monitoring the industry's economic performance and the state of the national and international beer markets.
Keywords: beer, education, legislation, market, health, brewing industry, public relations, licensed trade,
Subject A002
Title THE BREWING INDUSTRY - TEN YEARS ON.
Authors Guthrie, G.
Source Brew. Distill. Int.
BIO Sept. 2001, 32(9), 16-18.
Abstract The actual changes which have taken place in the UK brewing industry and beer trade since the early 1990s are discussed in comparison with predictions made by the author in a lecture presented in the spring of 1992. Topics covered include the consolidation of the industry through amalgamations, takeovers and the abandonment of brewing by some companies which remain in existence but operate in other lines of business (usually the public house, restaurant or hotel trade or some combination of these, sometimes with other leisure activities), the decline of the brewing companies' tied houses and the rise of chains owned by non brewing companies to take over the dominant position in the pub trade, the increase in take home beer sales, the growing importance of brand marketing, the continuing impact of legislation on environmental issues, food safety and taxation, the development of new roles for the research institutions, trade and industry associations, professional societies, etc., serving the brewing industry and the other trades and industries connected therewith, the growing importance of health and wholesomeness issues and the need to have research findings on beneficial effects of beer publicized by independent bodies with high public credibility, the global beer market and the different categories among the world's leading brewing companies. The author's opinions on likely future developments in some of these areas are also presented.
Keywords: beer, survey, brewing industry,
|

June 26th, 2009, 12:10 PM
|
 |
Wrox Author
Points: 12,642, Level: 48 |
|
|
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 3,900
Thanks: 0
Thanked 80 Times in 78 Posts
|
|
>Without using xslt 2 ( I'm just using ie 7 at the moment) is there a way to get the output like this.
Use Muenchian grouping.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |