Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] XSLT/XPath Question (Grouping Authors by First Character of Last Name)

From: "Kevin Grover" <kevin@--------------->
To:
Date: 3/4/2007 8:24:00 PM
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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent