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

Re: XSLT/XPath Question (Grouping Authors by First Ch

Subject: Re: XSLT/XPath Question (Grouping Authors by First Character of Last Name)
From: "Kevin Grover" <kevin@xxxxxxxxxxxxxxx>
Date: Sun, 4 Mar 2007 12:23:28 -0800
Re:  XSLT/XPath Question (Grouping Authors by First  Ch
On 3/3/07, Michael Kay <mike@xxxxxxxxxxxx> wrote:

> I tried embedding something like the above "for $a in.." into > an XSLT 2.0 stylesheet, and assign it to a variable, but I > get an error from saxon when I tried it.

There's really not much point in telling us this. If you tell us exactly
what you coded and what error message you got, then we can help you
understand what you did wrong. If you only tell us roughly what you coded
and that Saxon didn't like it, then all we can do is to extend our
symphathy.

Sorry, I was not meaning to imply anything bad about saxon, I meant it to demonstrate that I'd tried many various approaches, and came up short.

I'm a nutshell, I was trying to use the FLWOR expression to build a
list of the characters that I could later iterate over.  I dug through
my old files and discovered that I did not save the failing
expressions.  I don't think it was any fault of saxon, just of my own
ignorance.

It was something along these lines

<xsl:variable name="letters" select="for $a in //author return
substring($a,1,1)"/>

but I had distinct or unique keywords in there.  When I tried the
above yesterday, or worked, but I could not iterator over it in a for
each loop.


As Dimitre points out, you've got a simple grouping problem here and xsl:for-each-group should sort it out very easily.


I didn't say this in the original post, but I was hoping to get this working using XSLT 1.0 (just because I'm annoyed that it's been so hard). Dimitre's XSLT 2.0 code is much cleaner, and I'll probably move my XSL stuff to 2.0 and start using saxon (I was using xsltproc from libxslt)

Thanks for the quick feedback.  Sorry this reply took so long, I
looked through my SVN repository to see if I saved some of the old
test files.

- Kevin

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.