[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|