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

RE: Split element with mixed content

Subject: RE: Split element with mixed content
From: "Kevin Bird" <kevin.bird@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 2 Aug 2007 16:56:22 +0100
RE:  Split element with mixed content
Input
-----
<root>
    <p>The quick <b>brown</b> fox jumped over the lazy dog.</p>
</root>


Stylesheet
----------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
    <xsl:output method="xml" indent="yes"/>
    <xsl:strip-space elements="*"/>

    <xsl:template match="root">
        <root>
            <xsl:analyze-string select="p" regex="over .*">
                <xsl:matching-substring>
                    <p>
                        <xsl:copy-of select="."/>
                    </p>
                </xsl:matching-substring>
                <xsl:non-matching-substring>
                    <p>
                        <xsl:copy-of select="."/>
                    </p>
                </xsl:non-matching-substring>
            </xsl:analyze-string>
        </root>
    </xsl:template>
</xsl:stylesheet>
Output
------
<root>
   <p>The quick brown fox jumped </p>
   <p>over the lazy dog.</p>
</root> 


Kind regards.
 
--
Kevin Bird
Matrix




> -----Original Message-----
> From: Florent Georges [mailto:darkman_spam@xxxxxxxx]
> Sent: 02 August 2007 16:42
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re:  Split element with mixed content
>
> Kevin Bird wrote:
>
>   Hi
>
> > Using analyze-string and tokenize only gives me the string value of
> > the <b> element. Am I missing something very obvious?
>
>   What did you try so far?
>
>   Regards,
>
> --drkm
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________________________________
> ______
> Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo!
> Mail

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.