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(_at_)nag(_dot_)co(_dot_)uk> 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
--~------------------------------------------------------------------
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>
--~--