[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: text() children
] ]<div>Primary contributions by David Ornstein ] <a href="mailto:davido@xxxxxxxxxxxxx">davido@xxxxxxxxxxxxx</a> ] and Kai Matthews with scientific review by Dr. Karl M. Johnson. ]<p>This document provides answers to common questions about Ebola. For ]more information about Ebola </p> ]</div> ] ] ]I want as output ] ]<p>Primary contributions by David Ornstein ] <a href="mailto:davido@xxxxxxxxxxxxx">davido@xxxxxxxxxxxxx</a> ] and Kai Matthews with scientific review by Dr. Karl M. Johnson. </p> ]<p>This document provides answers to common questions about Ebola. For ]more information about Ebola </p> ] ]The input tree is mixed pcdata and elements. Is all your pcdata at the start, in which case it's fairly easy. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" > <xsl:template match="div"> <p> <xsl:apply-templates select="text()|*[not(self::p)]"/> </p> <xsl:apply-templates select="p"/> </xsl:template> <xsl:template match="*"> <xsl:copy-of select="."/> </xsl:template> </xsl:stylesheet> produces the above output modulo white space. If you over simplified your example, and the content of div is alternating stuff: p elements which you want to copy, and stuff not in p which you want to wrap, then you do have to work a bit harder. David XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|