Subject: [xsl] analyze-string and child nodes From: Terry Ofner <tdofner@xxxxxxxxx> Date: Mon, 10 May 2010 12:16:11 -0400 |
I am placing numbered paragraphs into table rows and cells using the following template: <xsl:template match="p[@class=('selectionindent_numbered','oldstyles-numbered','bodytext-nu mbered')]"> <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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Trouble creating tables w, Michael Kay | Thread | Re: [xsl] analyze-string and child , David Carlisle |
Re: [xsl] Trouble creating tables w, Charles-Louis De Mae | Date | Re: [xsl] analyze-string and child , David Carlisle |
Month |