Subject: RE: [xsl] empty element question From: M C <mcundiff11@xxxxxxxxx> Date: Fri, 16 Oct 2009 13:31:41 -0700 (PDT) |
Thank you Michael and Ken for pointing out that this is a grouping problem. Very clear. I know this is the wrong list but it makes wonder then how you do it with XQuery... Thanks, Morgan --- On Fri, 10/16/09, Michael Kay <mike@xxxxxxxxxxxx> wrote: > From: Michael Kay <mike@xxxxxxxxxxxx> > Subject: RE: [xsl] empty element question > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Date: Friday, October 16, 2009, 8:15 PM > > In XSLT 2.0, using positional grouping: > > <xsl:for-each-group select="node()" > group-starting-with="lb"> > <p> > <xsl:copy-of > select="current-group()[not(self::lb)]"/> > </p> > </xsl:for-each-group> > > This is sufficiently general to handle more complex > instances than you show: > multiple <lb/> elements, other markup as children of > <p>, etc. It doesn't > handle the more complex problem of an <lb/> element > that's a descendant of > the <p> element rather than a child - that one comes > up on this list > occasionally, and is hard. > > Regards, > > Michael Kay > http://www.saxonica.com/ > http://twitter.com/michaelhkay > > > > -----Original Message----- > > From: M C [mailto:mcundiff11@xxxxxxxxx] > > > Sent: 16 October 2009 21:05 > > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > > Subject: [xsl] empty element question > > > > How do I transform this input document: > > > > <div> > > <p>string > 1<lb/>string 2</p> > > </div> > > > > to this output document? > > > > <div> > > <p>string 1</p> > > <p>string 2</p> > > </div> > > > > Thanks, > > Morgan
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] empty element question, Michael Kay | Thread | RE: [xsl] empty element question, Michael Kay |
RE: [xsl] empty element question, Michael Kay | Date | Re: [xsl] Concat function returning, George Cristian Bina |
Month |