xsl-list
[Top] [All Lists]

RE: Help: amalgamate a series of consecutive mixed nodes

2006-02-14 08:34:33
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(_at_)castingthevoid(_dot_)com>
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
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



--~------------------------------------------------------------------
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>
--~--


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


--~------------------------------------------------------------------
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>