[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Revision Marking in HTML
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 ________________________________________________________________________
|
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
|