xsl-list
[Top] [All Lists]

Re: [xsl] analyze string issues

2008-03-24 15:05:50
Answered my own question with the following:

<xsl:template match="stem/text()">
        <xsl:analyze-string select="." regex="\t[0-9][0-9]?\.\t">
        <xsl:non-matching-substring>
                <xsl:value-of select="."/>
        </xsl:non-matching-substring>
        </xsl:analyze-string>
</xsl:template>

Terry Ofner
1541 Northbrook Drive
Indianapolis, IN 46260
Voice: 317-870-1992
Fax: 317-870-7101

tofner(_at_)comcast(_dot_)net




On Mar 24, 2008, at 6:00 PM, Terry Ofner wrote:

I am having trouble stripping numbers from a list of items. Here is a snippet of my xml:

<book>
<stem>    1.      Read the sentence... </stem>
<stem> 2. What language is the word <i>defense</i> originally from? </stem>
</book>

My current template is

<xsl:template match="stem">
        <xsl:analyze-string select="." regex="\t[0-9][0-9]?\.\t">
         <xsl:non-matching-substring>
                <stem><xsl:copy-of select="."/></stem>
        </xsl:non-matching-substring>
        </xsl:analyze-string>
</xsl:template>


The template does what I want. It removes the tabs, numbers, and periods. But it also removes the <i> elements so that I end up with

<book>
<stem>Read the sentence... </stem>
<stem>What language is the word defense originally from?</stem>
</book>

How can I strip off the numbers and retain the inline elements of the <stem> element?

Terry Ofner






--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>