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

Re: analyze-string and child nodes

Subject: Re: analyze-string and child nodes
From: Terry Ofner <tdofner@xxxxxxxxx>
Date: Tue, 11 May 2010 16:19:52 -0400
Re:  analyze-string and child nodes
Thank you David. The template works perfectly. I only needed to add one ] near
the end of the match line. The take-away message for me: when one wants to
apply-templates with regular expressions, use replace() instead of
analyze-string. Is that an accurate summary of the approach?

Terry


On May 10, 2010, at 12:22 PM, David Carlisle wrote:

> 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[@class=('selectionindent_numbered','oldstyles-numbered','bodytext-nu
mbered')]">
>>            <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[@class=('selectionindent_numbered','oldstyles-numbered','bodytext-nu
mbered')][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.
________________________________________________________________________

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