Hi David,
I will give it a shot and see what happens.
Thanks
Nadia Swaby
Knowledge Management, Plant #22
ext. 5466
David Carlisle
<davidc(_at_)nag(_dot_)co(_dot_)u To:
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
k> cc:
Subject: Re: [xsl] Revision
Marking in HTML
2005-04-26 08:40
Please respond
to xsl-list
this is essentially a grouping problem: you want to group all nodes
between matching Pis together, and any of the standard XSLT1 grouping
techniques can be used.
I can't tell from your posting whether it's a hard or an easy problem
In particular, where can the processing instructions appear.
If I insert some text that starts in one element and finishes in another
do I edn up with
<para> fooo <?xm-insertion_mark_start ?> bar</para>
<para> more bar <?xm-insertion_mark_end ?> more foo>/para>
If so, your problem is "interesting".
If the PIs always appear in pairs that are well balanced with respect to
the element nesting, the problem is a lot less "interesting" but a lot
more feasible to supply a completely general solution.
I'll assume the latter, and offer the standard key based grouping
method:
<xsl:key name="p" match="node()"
use="generate-id(preceding-sibling::processing-instruction('xm-insertion_mark_start'))"/>
then whenever you would have use apply-templates, use
<xsl:choose>
<xsl:when test="text()[normalize-space()] and
processing-instruction('xm-insertion_mark_start')">
<xsl:apply-templates
select="processing-instruction('xm-insertion_mark_start')[1]/preceding-sibling::node()"/>
<xsl:for-each
select="processing-instruction('xm-insertion_mark_start')">
<span class="revcontrol>
<xsl:apply-templates select="key('p',generate-id())"/>
</span>
</xsl:for-each>
</xsl:when>
<xsl:when test="processing-instruction('xm-insertion_mark_start')">
<xsl:apply-templates
select="processing-instruction('xm-insertion_mark_start')[1]/preceding-sibling::node()"/>
<xsl:for-each
select="processing-instruction('xm-insertion_mark_start')">
<div class="revcontrol>
<xsl:apply-templates select="key('p',generate-id())"/>
</div>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
David (untested)
________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--