[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] How to split mixed content
I'm looking for a way to split mixed content. Something like the tokenize() function but for mixed content. Let us say inside a "p" element containing escaped markup, real XHTML like "span" elements and "br" elements. I want to use the "br" element as splitter. I have come up with the following solution that seems to work. <xsl:template match="p"> <lines> <xsl:for-each-group select="node()" group-starting-with="br"> <xsl:if test="position() = 1"> <line><xsl:copy-of select="current-group()"/></line> </xsl:if> <xsl:if test="position() > 1"> <line><xsl:copy-of select="current-group() except ."/></line> </xsl:if> </xsl:for-each-group> </lines> </xsl:template> Here is my question: Is my solution the way to split mixed content or is there an easier or a more elegant way? Cheers, Jesper Tverskov http://www.xmlkurser.dk http://www.xmlplease.com
|
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
|