Mixing pull and push

Subject: Mixing pull and push
From: "Pawson, David" <DPawson@xxxxxxxxxxx>
Date: Mon, 4 Sep 2000 14:56:25 +0100
The lack of structure in a DTD I've been given is causing me a headache.
Its essentially an XHTML subset. h1 to h4, usual mix of p, ul, ol etc.

The problem centres around trapping Hx elements
in push elements, then using moded templates for
non Hx elements.

Previously I've either pushed or pulled, this is the first
time I've had to do both together.
I'd assumed that I could have nop templates (unmoded) to
handle all the push elements.

I'm basically looking for an output (xml)
that looks like
  <h1><head>Old h1 content</head

    any content up to next sibling
    Hx, copied would do it, but lets say
    p maps to xp, table to xtable etc.

   <h2><head>Old h2 content</head>
     nesting down to h4's
   <h1><head>  etc.

the algorithm to validate which levels to close
and so on would be straightforward in an ordinary language,
but I'm having difficulties using XSLT for it.

Since I'm basically dealing with the sibling axis, 
I'm finding that I'm double processing elements, 
once, when I pull them using apply-templates select="following-sibling::....
and then again as a response to either a moded template or
a non moded template.

I'm looking for an approach that sounds reasonable
in outline.
I've tried 3 so far, and each works simplistically, but
falls down with real content. 

  the only time I want to use xsl:apply-templates/> is with
the (very) few actual nested elements such as lists and tables.

Any suggestions appreciated.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread