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

Subject: Re: [xsl] Help: amalgamate a series of consecutive mixed nodes
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 14 Feb 2006 10:39:23 GMT
  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?

Not surprisingly it's easier to say these things in xpath (or as here,
xslt patterns) than it is to say them in english, as that's the point of
having two (or more) languages:-)

<xsl:template match="list[following-sibling::*[1][self::indent or self::otherfollower]
.... last item in a list followed by an indent  or otherfollower

<xsl:template match="indent[preceding-sibling::*[not(self::indent or self::otherfollower)]

<xsl:template match="otherfollower[preceding-sibling::*[not(self::indent or self::otherfollower)]

I think they probably answer your question, although it may be
(depending what output you are making) that the problem is best
approached as a "grouping problem". and use one of the stabdard xslt 1
grouping idioms (eg using keys) or xslt2 grouping instructions.


This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

Current Thread