xsl-list
[Top] [All Lists]

Re: [xsl] analyze-string and child nodes

2010-05-10 11:23:25
On 10/05/2010 17:16, Terry Ofner wrote:
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?) (.*)">


you only want to analyse the first (text) node so change the above to


<xsl:template match="p[(_at_)class=('selectionindent_numbered','oldstyles-numbered','bodytext-numbered')][node()[1][self::text()]">
<row>
<cell>
<xsl:value-of select="replace(text()[1],'^ ?(\d\d?) (.*)','$1')"/></cell>
<cell>
<xsl:value-of select="replace(text()[1],'^ ?(\d\d?) (.*)','$2')"/>
<xsl:apply-templates select="node()[position()!=1]"/>
</cell>
</row>
</xsl;template>


David
(untested, so modulo my typing accuracy)

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. ________________________________________________________________________

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