Re: [xsl] grouping flat structure, part three

Subject: Re: [xsl] grouping flat structure, part three
From: Terry Ofner <tofner@xxxxxxxxxxx>
Date: Fri, 25 Jan 2008 13:36:14 -0500
Now I am thoroughly confused. I am trying to start small and work up. For example, I would think that this template would group the @class=NarrBody elements. It groups the questions as well (see output below).

<xsl:template match="part">
<xsl:for-each-group select="par" group-adjacent="@class='NarrBody'">
<narrative>
<xsl:copy-of select="current-group()"/>
</narrative>
</xsl:for-each-group>
</xsl:template>

Output:

<narrative>
<par class="NarrBody">key [ke(long mark over e)] <inline style="font-family: &#34;TimesNewRomanPS Italic&#34;;">n.</inline>
<inline style="font-weight: bold;">1.</inline> piece of shaped metal used to open or close a lock. <inline style="font- weight: bold;">2.</inline> device for winding toys, clocks, etc. <inline style="font-weight: bold;">3.</inline> important ingredient or element. <inline style="font-weight: bold;">4.</inline> nroup of musical tones.</par>
</narrative>


<narrative>
<par class="stem_mc"> 4.1 What part of speech is the word <inline style="font-style: italic;">key</inline> in this entry?</par>
<par class="choice"> A verb</par>
<par class="choice"> B noun</par>
<par class="choice"> C adjective</par>
<par class="choice"> D adverb</par>
<par class="Answer">B</par>
<par class="g_code">G5U1S9</par>
<par class="stem_mc"> 5.1 Which definition of <inline style="font-style: italic;">key</inline> matches how the word is used in the following sentence?</par>
<par class="display">What key should I play that in?</par>
<par class="choice"> A definition 1</par>
<par class="choice"> B definition 2</par>
<par class="choice"> C definition 3</par>
<par class="choice"> D definition 4</par>
<par class="Answer">D</par>
<par class="g_code">G5U1S9</par>
<par class="NarrIntro">2. Directions: Study the homographs. Then answer the related question(s).</par>
</narrative>


<narrative>
<par class="NarrBody">
<inline style="font-weight: bold;">scale</inline> device for measuring weight</par>
<par class="NarrBody">
<inline style="font-weight: bold;">scale</inline> series of steps or degrees </par>
<par class="NarrBody">
<inline style="font-weight: bold;">scaln</inline> series of musical notes</par>
<par class="NarrBody">
<inline style="font-weight: bold;">scale</inline> outer body layer of fish and snakes</par>
</narrative>



On Jan 25, 2008, at 5:13 PM, David Carlisle wrote:




I have solved the narrative group this way:

<xsl:for-each-group select="par[@class='NarrBody']" group- adjacent="name()">



your select justselects par element, so they are all going to have name()='par' and end up in the same group aren't they?


David


______________________________________________________________________ __
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.


This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs.
______________________________________________________________________ __

Current Thread