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

Re: alphabetic set of xsl:result-document

Subject: Re: alphabetic set of xsl:result-document
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 22 Aug 2005 16:12:47 +0100
change to lower case
> are you saying I should do something along the (currently-broken)

sir, surely you are not suggesting that I would suggest a broken
approach? It will have to be pistols at dawn...

. selects exctly one thing and lower-case() doesn't change that so this
line isn't doing very much: you are sorting/grouping a sequence of length 1.
<xsl:for-each-group select="lower-case(.)"

You have the groups inside out: you first want (I think) to group on initial
letter, then, within that, group on the words.



<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
 
<xsl:template match="/">
<xsl:for-each-group select="//w" group-by="lower-case(substring(.,1,1))">
<xsl:result-document href="FILE-{current-grouping-key()}.html">
<html>
<body>
<h1>words beginning with <xsl:value-of select="lower-case(substring(.,1,1))"/></h1>
<xsl:for-each-group select="current-group()" group-by="lower-case(.)">
<p><xsl:value-of select="."/> (<xsl:value-of select="concat(count(current-group()),' time',
    if (current-group()[2]) then 's' else '')"/>) </p>
</xsl:for-each-group>
</body>
</html>
</xsl:result-document>
</xsl:for-each-group>
</xsl:template>



 </xsl:stylesheet>



saxon8 w.xml w.xsl

$ more FILE-*
::::::::::::::
FILE-a.html
::::::::::::::
<html>
   <body>
      <h1>words beginning with a</h1>
      <p>a (10 times) </p>
   </body>
</html>
::::::::::::::
FILE-b.html
::::::::::::::
<html>
   <body>
      <h1>words beginning with b</h1>
      <p>boring (1 time) </p>
   </body>
</html>
::::::::::::::
FILE-i.html
::::::::::::::
<html>
   <body>
      <h1>words beginning with i</h1>
      <p>is (5 times) </p>
   </body>
</html>
::::::::::::::
FILE-o.html
::::::::::::::
<html>
   <body>
      <h1>words beginning with o</h1>
      <p>only (5 times) </p>
   </body>
</html>
::::::::::::::
FILE-s.html
::::::::::::::
<html>
   <body>
      <h1>words beginning with s</h1>
      <p>simplified (1 time) </p>
   </body>
</html>
::::::::::::::
FILE-t.html
::::::::::::::
<html>
   <body>
      <h1>words beginning with t</h1>
      <p>This (5 times) </p>
      <p>test (10 times) </p>
   </body>
</html>


________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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.