xsl-list
[Top] [All Lists]

Re: [xsl] That's a wrap!

2018-01-04 13:19:35
Thanks. This gets me where I need to be, and introduces me to ways of doing 
things I did not know about. I'm looking at the grouping examples on W3C now.

The only issue is that the grouping of adjacent nodes captures the leading and 
trailing text as well as the text between. I don't need to solve the problem 
for my current uses, however. (I'm making test files for a DTD.)

Thanks again to this community!

-----Original Message-----
From: Martin Honnen martin(_dot_)honnen(_at_)gmx(_dot_)de 
[mailto:xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com] 
Sent: Thursday, January 4, 2018 1:26 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] That's a wrap!

On 04.01.2018 19:16, Charles O'Connor coconnor(_at_)ariessys(_dot_)com wrote:
Thanks to you and Christophe.



For the below, I would want the second group of <string-name> elements to be 
in a different <person-group>, actually, but I hadn't gotten that far.

To me it looks as if

   <xsl:template match="mixed-citation">
       <xsl:copy>
           <xsl:for-each-group select="node()" 
group-adjacent="boolean(self::string-name | self::etal | self::collab | 
self::text())">
               <xsl:choose>
                   <xsl:when test="current-grouping-key() and 
current-group()[self::*] ">
                       <person-group>
                           <xsl:apply-templates select="current-group()"/>
                       </person-group>
                   </xsl:when>
                   <xsl:otherwise>
                       <xsl:apply-templates select="current-group()"/>
                   </xsl:otherwise>
               </xsl:choose>
           </xsl:for-each-group>
       </xsl:copy>
   </xsl:template>

might do the job.

--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>