Just change your
<xsl:if test="self::matching_group">
into an xsl:choose/xsl:when, and add
<xsl:otherwise><xsl:copy-of select="current-group()"/></xsl:otherwise>
Michael Kay
http://www.saxonica.com/
-----Original Message-----
From: Terry Ofner [mailto:tofner(_at_)comcast(_dot_)net]
Sent: 13 February 2008 15:39
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] group-adjacent problem
I have this xml input:
<title>
<ChapNum>10</ChapNum>
<ChapName>Character Development</ChapName>
<Story>
<ma>_____ 1. denouement</ma>
<ma>_____ 2. conflict</ma>
<ma>_____ 3. fourth wall</ma>
<ma>_____ 4. turning point</ma>
<ma>_____ 5. nonrealistic</ma>
<ma>_____ 6. presentational</ma>
<ma>_____ 7. representational</ma>
<ma>_____ 8. resolution</ma>
<ma>_____ 9. rising action</ma>
<ma>_____ 10. subtext</ma>
<matching_group>a. falling action</matching_group>
<matching_group>b. without reference to the audience</
matching_group>
<matching_group>c. struggle</matching_group>
<matching_group>d. highest emotional intensity</matching_group>
<matching_group>e. exaggerated</matching_group>
<matching_group>f. direct address</matching_group>
<matching_group>g. completion</matching_group>
<matching_group>h. complications</matching_group>
<matching_group>i. implied information</matching_group>
<matching_group>j. convention of realistic theatre</
matching_group>
<sa>11. What are the elements of traditional play
structure?</sa>
<sa>12. What techniques can you employ for timely cue
pickup?</
sa>
<es>13. What steps can help you develop a
characterization?</es>
</Story>
</title>
I need to process all the elements inside the story element.
One thing I need to do is group the <matching_group>
elements. Here is one of the templates I have tried to do this:
<xsl:template match='Story[child::matching_group]'>
<xsl:for-each-group select="*" group-adjacent="name()">
<xsl:if test="self::matching_group">
<matching-group>
<choices columns='1'>
<xsl:for-each select="current-group()">
<xsl:apply-templates select="."/>
</xsl:for-each>
</choices>
</matching-group>
</xsl:if>
</xsl:for-each-group>
</xsl:template>
This works to group the <matching_group> elements. However,
it cuts the <ma>, <sa>, and <es> elements from the result:
<title>
<ChapNum>10</ChapNum>
<ChapName>Character Development</ChapName>
<matching-group>
<choices columns="1">
<choice-a>falling action</choice-a>
<choice-b>without reference to the audience</choice-b>
<choice-c>struggle</choice-c>
<choice-d>highest emotional intensity</choice-d>
<choice-e>exaggerated</choice-e>
<choice-f>direct address</choice-f>
<choice-g>completion</choice-g>
<choice-h>complications</choice-h>
<choice-i>implied information</choice-i>
<choice-j>convention of realistic theatre</choice-j>
</choices>
</matching-group>
</title>
Any hints would be appreciated.
Terry Ofner
tofner(_at_)comcast(_dot_)net
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--