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

Wrapping around textual and element node at the same t

Subject: Wrapping around textual and element node at the same time
From: Gábor Tóth <roysy@xxxxxxxx>
Date: Thu, 9 Sep 2010 09:29:42 +0100
 Wrapping around textual and element node at the same t
Dear All,

I am trying to wrap around words in a paragraph which looks like this.


<text><p><gliph>T</gliph>his is a very short
parapraph.<gliph>I</gliph>t is also tricky. </p> </text>


The result what I would like,  should look like this.

<text>
    <p>
        <seg><gliph>T</gliph>his</seg>
        <seg>is</seg>
        <seg>a</seg>
        <seg>very</seg>
        <seg>short</seg>
        <seg>parapraph.</seg>
        <seg><gliph>I</gliph>t </seg>
        <seg>is</seg>
        <seg>also</seg>
        <seg>tricky.</seg>
    </p>
</text>

For wrapping around all words I use this template.

<xsl:template match="text/p/text()">


        <xsl:analyze-string select="." regex="\w+">

            <xsl:matching-substring>


                <seg ><xsl:value-of select="."/></seg>

            </xsl:matching-substring>
            <xsl:non-matching-substring>
                <xsl:value-of select="."/>
            </xsl:non-matching-substring>
        </xsl:analyze-string>
    </xsl:template>

However, this template wraps around only the textual nodes but cannot do this:

<seg><gliph>T</gliph>his</seg>.

Is there any way to wrap around a textual node and an element node together?

Or should I do the wrapping first and then moving the gliph element later?

Thanks,

Gabor

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-2011 All Rights Reserved.