[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: empty element question

Subject: RE: empty element question
From: M C <mcundiff11@xxxxxxxxx>
Date: Fri, 16 Oct 2009 13:31:41 -0700 (PDT)
RE:  empty element question
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:  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:  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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.