xsl-list
[Top] [All Lists]

[xsl] Combining of nested children

2012-09-05 22:35:48
I need to find <Items> in a <List> that have an identical <Heading> attributes except for the @id, and insert a <ToRefs> element from the <Item> without an @id into the <Item> that has the @id attribute. Sample input and output <Item>s are shown below.

I will need to do the same sort of insertion at the <SubDiv1> level, or at the two other possible nested levels of <SubDiv2> and <SubDiv3> [not shown].

I will try to figure out how to do those latter cases once I understand how to do the <Headings> case.

Any help appreciated,
Thanks,
Mark

Input:

<List>
 <Item>
   <Heading id="A4" entry="subject" data="Abolition of Serfdom">
<SubDiv1 id="A4-1" catalog="1" scott-number="350" pofis-number="474" data="1948. 100th Anniversary of Abolition">
       <Article>
         <Person>Bulletin of the Ministry of Posts</Person>
         <Title>New issues [Title varies or absent]</Title>
       </Article>
     </SubDiv1>
   </Heading>
 </Item>
 <Item>
   <Heading entry="subject" data="Abolition of Serfdom">
<ToRef xref="See also" data="Slovakia - Peasant Revolt 1848" file="s" block="A1272-21"/>
   </Heading>
 </Item>
</List>

Output:
<List>
 <Item>
   <Heading id="A4" entry="subject" data="Abolition of Serfdom">
<ToRef xref="See also" data="Slovakia - Peasant Revolt 1848" file="s" block="A1272-21"/> <SubDiv1 id="A4-1" catalog="1" scott-number="350" pofis-number="474" data="1948. 100th Anniversary of Abolition">
       <Article>
         <Person>Bulletin of the Ministry of Posts</Person>
         <Title>New issues [Title varies or absent]</Title>
       </Article>
     </SubDiv1>
   </Heading>
</Item>


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>