[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: "Christian Wittern" <cwittern@xxxxxxxxx>
Date: Wed, 3 Oct 2007 17:28:54 +0900
Re:  segmenting a paragraph
First of all, thanks David, this was in fact what I was looking for
(and now realized that I went down a similar path some time ago..).

On 02/10/2007, David Carlisle <davidc@xxxxxxxxx> wrote:
>
> > This is essentially a variant of the approach using saxon:serialize(), which
> > inserts the strings <note> and </note> instead of @@@@@ and !!!!!.
>
> yes but it's for the simpler case (that I think we are in) that you can
> remove the entire note element (and put it back later) saxon serialise
> would not only put <note> there it would flatten out all its contents as
> well, (which is why you'd needs saxon:parse to reconstruct it)

Indeed, I found out that the method of taking out the note as a whole
and put it back later is the solution I need, since otherwise the
regex processing potentially messes up the content of the notes and
produces a string that can't be parsed back into XML.

However, I came across a little problem in the code:


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

Here we count the preceding note elements.

<xsl:matching-substring>
<xsl:copy-of select="$p/note[position()=regex-group(1)]"/>
</xsl:matching-substring>

However, here we count all preceding nodes, no?  So in some cases I
get the wrong note inserted.  Is there a way to limit the value
returned by position in the XPath expression in the same way to return
only preceding siblings element nodes with the name note?

best,

Christian

-- 
Christian Wittern, Kyoto

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.