Subject: RE: Problem with grouping sibling tags
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 23 Dec 2008 10:41:50 -0000
|
Go to http://xsl.markmail.org/ and search for "group adjacent bullets".
Michael Kay
http://www.saxonica.com/
> -----Original Message-----
> From: Casper Voortman [mailto:casper.voortman@xxxxxxxxxxxx]
> Sent: 23 December 2008 10:25
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Problem with grouping sibling tags
>
> Hey everyone,
>
> I have a problem within an xslt i'm writing that i just can't
> figure out how to solve. I think i have to use either some
> kind of grouping or work with preceding-sibling or
> following-sibling, maybe even both combined together. It has
> to be done in xslt version 1.0 which (for as much as i have
> read on it) seems to be more complicated on itself as far as
> groupings and such go.
>
> Here is a small description together with some samples.
>
> The XML follows a structure like the following ( i have
> replaced the original text for 'textcontent' and 'bullet'
> otherwise it would get too long a mail):
>
> <?xml version="1.0" encoding="UTF-8"?>
> <ArticleContent>
> <Frame Label="BroodTekst">
> <Paragraph Pstyle="Tussenkop">
> <Text Cstyle="[No character style]">textcontent</Text>
> <Text Cstyle="[No character style]"/>
> </Paragraph>
> <Paragraph Pstyle="PlattetekstInitiaal">
> <Text Cstyle="[No character style]">textcontent</Text>
> </Paragraph>
> <Paragraph Pstyle="PlattetekstBullet">
> <Text Cstyle="[No character style]">bullet1</Text>
> </Paragraph>
> <Paragraph Pstyle="PlattetekstBullet">
> <Text Cstyle="[No character style]">bullet2</Text>
> </Paragraph>
> <Paragraph Pstyle="Plattetekst">
> <Text Cstyle="[No character style]">textcontent</Text>
> </Paragraph>
> <Paragraph Pstyle="Plattetekst">
> <Text Cstyle="[No character style]">textcontent</Text>
> </Paragraph>
> <Paragraph Pstyle="PlattetekstBullet">
> <Text Cstyle="[No character style]">bullet3</Text>
> </Paragraph>
> </Frame>
> </ArticleContent>
>
> This needs to be converted to another XML file that has the following
> structure:
>
> <?xml version="1.0" encoding="utf-8"?>
> <section role="broodtekst">
> <title role="tussenkop">textcontent</title>
> <para role="plattetekstinitiaal">textcontent</para>
> <itemizedlist>
> <listitem>
> <para role="plattetekstbullet">bullet1</para>
> </listitem>
> <listitem>
> <para role="plattetekstbullet">bullet2</para>
> </listitem>
> </itemizedlist>
> <para role="plattetekst">textcontent</para>
> <para role="plattetekst">textcontent</para>
> <itemizedlist>
> <listitem>
> <para role="plattetekstbullet">bullet3</para>
> </listitem>
> </itemizedlist>
> </frame>
>
> Now my problem is with the original tags <Paragraph
> Pstyle="PlattetekstBullet"> these need to be grouped together
> in the new tag <itemizedlist>, but the structure within the
> story needs to stay intact. So when another <Paragraph
> Pstyle="PlattetekstBullet"> appears that is not preceded or
> followed by the same <Paragraph Pstyle="PlattetekstBullet">
> tag they need to be grouped as well separately.
>
> I can provide the XSLT i have sofar if needed, but it's a
> fairly long one and it might clutter the issue.
>
> Any help would be greatly appreciated and would make my x-mas.
>
> Regards,
>
> Casper Voortman
|