[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: How to remove outer tag if present in XSLT
On Fri, 2023-03-17 at 19:44 +0000, Matt Van Voorhies mvanvoorhies@xxxxxxxxxxx wrote: > > B B B B B Ungroup (remove) the outer <p> if it is the only element that > is a child of the arbitrary outer node (and is a <p> node).. > > B B B B B So a <div> > B B B B B B B B B B B ... > B B B B B B B B B B B ... > B B B B B B B B B </div> > B B B B > B B B B B Would not unwrap, since it's a "<div>" and not a "<p>" <xsl:template match="p[p and count(../*) = 1]"> <xsl:apply-templates/> </xsl:template> will unwrap every p element that contains p element and has no siblings. liam -- Liam Quin,B https://www.delightfulcomputing.com/ Available for XML/Document/Information Architecture/XSLT/ XSL/XQuery/Web/Text Processing/A11Y training, work & consulting. Barefoot Web-slave, antique illustrations: B http://www.fromoldbooks.org
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|