[xsl] grouping/sorting on delimited field

Subject: [xsl] grouping/sorting on delimited field
From: Nathan Shaw <n8shaw@xxxxxxxxx>
Date: Tue, 19 Jul 2005 11:19:10 -0700 (PDT)
Hi all. I am a digester, so I would appreciate a
direct reply along with your reply to the list.
 
I have XML that looks like this:
 
<dataroot
xmlns:od="urn:schemas-microsoft-com:officedata"
generated="2005-06-07T15:27:42">
  <HQPayloads>
    <MotherPayload>ADF</MotherPayload>
    <PayloadTitle>Avian Development Biology
Experiment</PayloadTitle>
    <Increment>|4|</Increment>
  </HQPayloads>
  <HQPayloads>
    <MotherPayload>ADUM</MotherPayload>
    <PayloadTitle>Advanced Diagnostic Ultrasound in
Microgravity</PayloadTitle>
    <Increment>|8||9||10||11|</Increment>
  </HQPayloads>
  <HQPayloads>
      <MotherPayload>AFEL</MotherPayload>
      <PayloadTitle>Advanced Flight Engineering
Lab</PayloadTitle>
      <Increment>|3|6||8|</Increment>
  </HQPayloads>
</dataroot> 
 
and I need to sort and group on the <Increment>
element so that I end up with something like this:
 
<p>Increment 1<br/>
  <PayloadTitle> (<MotherPayload>)<br/>
  <PayloadTitle> (<MotherPayload>)<br/>
  <PayloadTitle> (<MotherPayload>)
</p>
 
<p>Increment 2<br/>
  <PayloadTitle> (<MotherPayload>)
  <PayloadTitle> (<MotherPayload>)<br/>
  <PayloadTitle> (<MotherPayload>)<br/>
  <PayloadTitle> (<MotherPayload>)<br/>
  <PayloadTitle> (<MotherPayload>)
</p>
 
<p>Increment 3<br/>
  <PayloadTitle> (<MotherPayload>)
  <PayloadTitle> (<MotherPayload>)<br/>
  <PayloadTitle> (<MotherPayload>)
</p>
 
<p>Increment 4<br/>
  <PayloadTitle> (<MotherPayload>)
  <PayloadTitle> (<MotherPayload>)<br/>
  <PayloadTitle> (<MotherPayload>)<br/>
  <PayloadTitle> (<MotherPayload>)
</p>
 
I am using XSLT 1, Saxon and am trying to avoid
extension functions (one option would be to use
Saxon's range function and loop from 1 to 11, using
contains()).
 
Any ideas/help is appreciated! I have never had to
sort/group on a delimited field before.
 
--Nate


		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 

Current Thread