xsl-list
[Top] [All Lists]

[xsl] analyze-string and child nodes

2010-05-10 11:16:40
I am placing numbered paragraphs into table rows and cells using the following 
template:

<xsl:template 
match="p[(_at_)class=('selectionindent_numbered','oldstyles-numbered','bodytext-numbered')]">
           <xsl:analyze-string select="." regex="^ ?(\d\d?) (.*)">
                  <xsl:matching-substring>
                    <xsl:variable name="paraNum" select="regex-group(1)"/>
                    <xsl:variable name="paragraph" select="regex-group(2)"/>
                    
                    <row>
                               <cell><xsl:value-of select="$paraNum"/></cell>   
   
                               <cell><xsl:value-of select="$paragraph"/></cell>
                    </row>
                  </xsl:matching-substring>
          </xsl:analyze-string>
 </xsl:template>

This template captures the number at the beginning of each paragraph and places 
it in the first cell of a row and places the paragraph in the second cell of 
the row. This works great except it strips out child nodes in the paragraph 
(leaving the text but not the tags). How can I retain these child nodes?

Input:

<p class="bodytext-numbered"> 1 It has .... </p>
<p class="bodytext-numbered"> 2 In April of 1483. . . . As <span 
class='underline'>Protector</span> of ....</p>

Current output:

<row>
        <cell>1</cell>
        <cell>It has .... </cell>
</row>
<row>
        <cell>2</cell>
        <cell>In April of 1483. . . . As Protector of ....</cell>
</row>

Desired output:

<row>
        <cell>1</cell>
        <cell>It has .... </cell>
</row>
<row>
        <cell>2</cell>
        <cell>In April of 1483. . . . As <span 
class='underline'>Protector</span> of ....</cell>
</row>

Thanks in advance for any help with this matter.

Terry
--~------------------------------------------------------------------
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>