Altova Mailing List Archives

Re: XQuerying material between elements

From: Pavel Lepin <p.lepin@-------.--->
Date: 4/25/2007 5:56:00 PM

Joseph Kesselman <keshlam-nospam@c...> wrote in
> > So, is it possible to write an XQuery expression that
> > can fix this, i.e. 'detect' that the <pb/> occurs in
> > the middle of another element and take the appropriate
> > action? The result would have to look something like
> > I'm sure XQuery can do it, though I'm not sure of the  
> > syntax offhand.
> In XPath, I would set up a template that matches on p[pb]
> (a paragraph that contains a page break) and rewrites it
> appropriately by first outputting a p containing the pb's
> preceeding siblings, then the pb, then a p containing the
> following siblings. Very straightforward.

XSLT does indeed seem like a better bet than XQuery in this
case, but if you try to generalize the problem a bit
(multiple page breaks and more than one level of ancestor
elements to be spliced) it gets kinda messy with XSLT1. On
the other hand, an XSLT2 solution would be fairly elegant
thanks to sequences--may FSM touch with his noodly
appendage whoever on XSLT WG came up with those.

Pavel Lepin


These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.