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

Re: segmenting a paragraph

Subject: Re: segmenting a paragraph
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 2 Oct 2007 13:03:39 +0100
Re:  segmenting a paragraph
> So far, I have been capturing the content of <p> in a string

don't do that, do this

<xsl:variable name="string" as="xs:string">
<xsl:value-of>
<xsl:apply-templates mode="zap-note"/>
</xsl:value-of>
</xsl:variable>
<xsl:variable name="p" select="."/>

then you want
<xsl:template match="note" mode="zap-node">
 <xsl:text>@@@@@</xsl:text>
 <xsl:value-of select="count(preceding-sibling::note)+1"/>
 <xsl:text>!!!!!</xsl:text>
</xsl:template>

so your string is

"Some text.  Some more text, with a comma. @@@@@1!!!!!"


> and then using  two nested <xsl:analyze-string> blocks with regexes,
> which work nicely and  do what I want.

so they should work on the above string (if @ or ! are used to look up
sentence punctuation in these regex, use different marker characters,
you can use unicode private use characters for example)

Then currently in you probably have something like

<xsl:matching-substring>
<seq><xsl:value-of select="."/></seq>
</xsl:matching-substring>

do instead




<xsl:matching-substring>
<seq>
<xsl:analyze-string select="." regex="@@@@@([0-9]*)!!!!!">
<xsl:matching-substring>
<xsl:copy-of select="$p/note[position()=regex-group(1)]"/>
</xsl:matching-substring>
...



so at the innermost level you can put the notes back.


David


________________________________________________________________________
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

Cast Your Vote

We need your help – Vote for DataDirect XML Products!

  • Best SOA or XML site

Winners and finalists announced at SOA World Conference in November.

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