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

Re: Re: Sorting on two levels

Subject: Re: Re: Sorting on two levels
From: "Michele R Combs mrrothen@xxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 15 Apr 2015 14:35:24 -0000
Re:  Re: Sorting on two levels
I did try  <xsl:apply-templates select="current-group()">, thinking it would
just go through and apply the existing indexterm, primary, secondary templates
-- but I got the entire group in a chunk, it didn't seem to apply templates to
each element  individually.  I'll go back and look, maybe I did something
wrong there.  I wasn't using mode, maybe that was the problem.

<xsl:for-each select="current-group()"> makes sense, will give that a try.

Last question: if I want to do something at the end of each group, I'd put
that instruction right before the </xsl:for-each-group>, correct?


-----Original Message-----
From: Martin Honnen martin.honnen@xxxxxx
[mailto:xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx]
Sent: Wednesday, April 15, 2015 10:04 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  Re: Sorting on two levels

Michele R Combs mrrothen@xxxxxxx wrote:
> The suggestion offered yesterday works great as far as the sorting, but I
need to do certain things to each item in a group as it's output, such as
wrapping each ID in an <a> element.  What I tried is shown below, but it
results in @href containing *all* the ids for the group.  How do I process
each item in a group separately?  Do I need to at some point just do
<xsl:apply-templates select=" current-group()"> and then rely on templates for
primary, secondary, etc.?  I did try that but couldn't seem to get it to work
-- either I got no output, or I got the entire group in a chunk.

>
>                              <a>
>
>                                 <xsl:attribute name="href">
>
>                                      <xsl:value-of
select="current-group()/@id"/>
>
>                                 </xsl:attribute>
>
>                                 <xsl:value-of select="current-group()/@id"
separator=", "/>
>

If you want to map each item in a group to an HTML "a" element then use

   <xsl:for-each select="current-group()">
     <a href="{@id}">
       <!-- not sure what you want to output for the link -->
       <xsl:value-of select="@id"/>
     </a>
   </xsl:for-each>

or use

   <xsl:apply-templates select="current-group()" mode="link"/>

and write a template

   <xsl:template match="indexterm" mode="link">
     <a href="{@id}">
       <!-- not sure what you want to output for the link -->
       <xsl:value-of select="@id"/>
     </a>
    </xsl:template>

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.