[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Help: amalgamate a series of consecutive mixed nodes


Subject: RE: [xsl] Help: amalgamate a series of consecutive mixed nodes
From: "Vasu Chakkera" <vasucv@xxxxxxxxxxx>
Date: Tue, 14 Feb 2006 15:34:33 +0000

I'm finding that difficult enough to specify in English,
may be then , you could give us a clear example of a good XML case and a good output that you wanted. It always helps.
Vasu



From: "Trevor Nicholls" <trevor@xxxxxxxxxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: [xsl] Help: amalgamate a series of consecutive mixed nodes
Date: Tue, 14 Feb 2006 15:16:33 +1300

Within some XML that I am processing are structures like the following:

<list>
  <item>...</item>
  <item>...</item>
</list>
<indent>...</indent>
<list>
  <item>...</item>
</list>

This structure does not mirror the document structure very well, because
logically the <indent> element is part of the <list>; it's a follow on from
the immediately preceding <list>/<item> element. But the XML reflects the
document formatting rather than the content :-(

If the requirement was simply to handle a single <indent> which followed a
<list> then I could manage it quite easily, by having a special <item>
template for the last <item> in a <list> whose first following-sibling was
an <indent>, and a null template for an <indent> whose first
preceding-sibling was a <list>. However it's not quite as straight forward
as this, because where I have an <indent> in my example I could in fact have
a series of elements, e.g. a mixed sequence of <indent>, <Sindent>, <SBody>,
and others.


So what I am after is (I suppose) a special template for the last <item> in
a <list> which is followed by one or more siblings whose names match a list
of permitted "followers", and a null template for any of these followers
which have a <list> amongst their preceding siblings, and which only have
permitted "followers" between themselves and the nearest <list>.

I'm finding that difficult enough to specify in English, and it's certainly
beyond me in XSL. Has anyone solved this kind of structural problem before?

Thanks
Trevor


_________________________________________________________________
The new MSN Search Toolbar now includes Desktop search! http://toolbar.msn.co.uk/



Current Thread
Keywords
xml