Subject: Re: [xsl] Revision Marking in HTML From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Mon, 02 May 2005 14:11:00 -0400 |
<xsl:key name="by-last-insertion-start" match="node()" use="generate-id(preceding-sibling::processing-instruction('xm-insertion_mark_start')[1])"/>
<xsl:key name="by-next-insertion-end" match="node()" use="generate-id(following-sibling::processing-instruction('xm-insertion_mark_end')[1])"/>
<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:for-each select="processing-instruction('xm-insertion_mark_start')"> <xsl:variable select="this-insertion-end-id" select="generate-id(following-sibling::processing-instruction('xm-insertion_mark_end')[1])"/> <div class="revcontrol"> <xsl:apply-templates select="key('by-last-insertion-start',generate-id()) [count(.|(key('by-next-insertion-end',$this-insertion-end-id))) = count(key('by-next-insertion-end',$this-insertion-end-id))]"/> </div> <xsl:apply-templates select="key('by-last-insertion-start',generate-id()) [count(.|(key('by-next-insertion-end',$this-insertion-end-id))) != count(key('by-next-insertion-end',$this-insertion-end-id))]"/> </xsl:for-each>
<?insert-start?> <a/> <?insert-end?> <b/> <?insert-start?> <c/> <?insert-end?>
Cheers, Wendell
I have been pondering it all morning. I have an idea what the problem is, but no idea how to fix it!
Here is the key declaration:
<xsl:key name="p" match="node()" use="generate-id(preceding-sibling::processing-instruction('xm-insertion_mark_start')[1])"/>
Here is the "apply-templates" section:
<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>
The problem is that if there is an xm-insertion_mark_start processing instruction found, all the following-sibling nodes get placed inside the <div class = "revcontrol"></div> section. I need to figure out a way to test to see if the node has a preceding-sibling::processing-instruction('xm-insertion_mark_start') and a following-sibling::processing-instruction('xm-insertion_mark_end'). So far, I have been having no luck, so I was hoping someone else had an idea.
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Revision Marking in HTML, Nadia . Swaby | Thread | Re: [xsl] Revision Marking in HTML, Nadia . Swaby |
Re: [xsl] Revision Marking in HTML, Nadia . Swaby | Date | Re: [xsl] Revision Marking in HTML, Nadia . Swaby |
Month |