Re: [xsl] Multiple hierarchy grouping (warning: longish)

Subject: Re: [xsl] Multiple hierarchy grouping (warning: longish)
From: Eric <kiteeatingtree@xxxxxxxxxxxxx>
Date: Fri, 28 May 2010 13:57:33 -0600
David,

Thank you very much for your response.

What is missing in the output your XSLT produced is Folder number 18 in Box
12, as well as the second and third items of Box 13, Folder 1.  Using your
output (I'm not using EAD for space reasons, but that's what I'm ultimately
trying to produce), what I am trying to produce is this:

<r>
  <Series id="2">
     <Subseries id="1">
        <Box id="12">
           <Folder>17</Folder>
           <FolderTitle>Symphonic Poem</FolderTitle>
           <FolderID>223</FolderID>
        </Box>
        <Box id="12">
           <Folder>18</Folder>
           <FolderTitle>Requiem Mass</FolderTitle>
           <FolderID>224</FolderID>
        </Box>
     </Subseries>
     <Subseries id="2">
        <Box id="12">
           <Folder>19</Folder>
           <FolderTitle>Symphony no. 4</FolderTitle>
           <FolderID>225</FolderID>
        </Box>
     </Subseries>
  </Series>
  <Series id="3">
     <Subseries id="">
        <Box id="12">
           <Folder>20</Folder>
           <FolderTitle>Symphony no. 5</FolderTitle>
           <FolderID>226</FolderID>
        </Box>
        <Box id="13">
           <Folder>1</Folder>
           <FolderTitle>Chamber music</FolderTitle>
           <FolderID>227</FolderID>
           <Item>String Quartet</Item>
           <Item>String Quartet no. 2</Item>
           <Item>Piano Trio Quartet</Item>
        </Box>
     </Subseries>
  </Series>
</r>

I guess is this is what is probably confusing me: something about the
<xsl:for-each-group>, my use of it, or something in my XPATH, is producing a
more limited group than it seems like it should.  As I understand it, the
groups created by the first <xsl:for-each-group> should be <Record[1,2,3]> and
<Record[4-7]>.  From that first set, the second <xsl:for-each-group> should
create two sets: <Record[1,2]> and <Record[3]>.  But the first set appears to
leave out <Record[2]>.  It seems like the same problem when applied to the
items.  The XSLT I was originally using did this correctly, but then couldn't
split a box between two series (box 12 appeared entirely under series 2, even
the parts that were supposed to be under series 3).

I appreciate any thoughts you, or anyone else on the list, might have.

Thanks!
Eric

>
> I'm not sure I fully understood the output format you gave, and teh input
wansn't a full document so I wrapped it in <r>, but possibly something like
the following
>
> <r>
> 	<Record>
> 		<Series>2</Series>
> 		<Subseries>1</Subseries>
> 		<Box>12</Box>
> 		<Folder>17</Folder>
> 		<FolderTitle>Symphonic Poem</FolderTitle>
> 		<FolderID>223</FolderID>
> 	</Record>
> 	<Record>
> 		<Series>2</Series>
> 		<Subseries>1</Subseries>
> 		<Box>12</Box>
> 		<Folder>18</Folder>
> 		<FolderTitle>Requeim Mass</FolderTitle>
> 		<FolderID>224</FolderID>
> 	</Record>
> 	<Record>
> 		<Series>2</Series>
> 		<Subseries>2</Subseries>
> 		<Box>12</Box>
> 		<Folder>19</Folder>
> 		<FolderTitle>Symphony no. 4</FolderTitle>
> 		<FolderID>225</FolderID>
> 	</Record>
> 	<Record>
> 		<Series>3</Series>
> 		<Box>12</Box>
> 		<Folder>20</Folder>
> 		<FolderTitle>Symphony no. 5</FolderTitle>
> 		<FolderID>226</FolderID>
> 	</Record>
> 	<Record>
> 		<Series>3</Series>
> 		<Box>13</Box>
> 		<Folder>1</Folder>
> 		<FolderTitle>Chamber music</FolderTitle>
> 		<FolderID>227</FolderID>
> 		<Item>String Quartet</Item>
> 	</Record>
> 	<Record>
> 		<Series>3</Series>
> 		<Box>13</Box>
> 		<Folder>1</Folder>
> 		<FolderTitle>Chamber music</FolderTitle>
> 		<FolderID>227</FolderID>
> 		<Item>String Quartet no. 2</Item>
> 	</Record>
> 	<Record>
> 		<Series>3</Series>
> 		<Box>13</Box>
> 		<Folder>1</Folder>
> 		<FolderTitle>Chamber music</FolderTitle>
> 		<FolderID>227</FolderID>
> 		<Item>Piano Trio Quartet</Item>
> 	</Record>
>
> </r>
>



> bash-3.2$ saxon9 records.xml records.xsl
> <r>
>   <Series id="2">
>      <Subseries id="1">
>         <Box id="12">
>            <Folder>17</Folder>
>            <FolderTitle>Symphonic Poem</FolderTitle>
>            <FolderID>223</FolderID>
>         </Box>
>      </Subseries>
>      <Subseries id="2">
>         <Box id="12">
>            <Folder>19</Folder>
>            <FolderTitle>Symphony no. 4</FolderTitle>
>            <FolderID>225</FolderID>
>         </Box>
>      </Subseries>
>   </Series>
>   <Series id="3">
>      <Subseries id="">
>         <Box id="12">
>            <Folder>20</Folder>
>            <FolderTitle>Symphony no. 5</FolderTitle>
>            <FolderID>226</FolderID>
>         </Box>
>         <Box id="13">
>            <Folder>1</Folder>
>            <FolderTitle>Chamber music</FolderTitle>
>            <FolderID>227</FolderID>
>            <Item>String Quartet</Item>
>         </Box>
>      </Subseries>
>   </Series>
> </r>

Current Thread