[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

An Interesting Wrinkle Re: Revision Marking in H

Subject: An Interesting Wrinkle Re: Revision Marking in HTML
From: Nadia.Swaby@xxxxxx
Date: Tue, 26 Apr 2005 11:20:50 -0400
xsl choose h
I found a new wrinkle!

If you are inserting several new block elements, this is what XMetal does:

<?xm-insertion_mark_start author="N. Swaby" time="20050426T110701-0500"?>
<para>This is new para1</para>
<para>This is new para2</para>
<?xm-insertion_mark_end?>

I was hoping that each individual block was surround by a pair of PIs.

I was thinking of using this for block elements:

<xsl:choose>
         <xsl:when
test="preceding-sibling::processing-instruction('xm-insertion_mark_start')
| following-sibling::processing-instruction('xm-insertion_mark_end')">
                  <div class="revcontrol">
                        <xsl:apply-templates/>
                  </div>
                  </xsl:when>
                  <xsl:otherwise>
                        <xsl:apply-templates />
                  </xsl:otherwise>
            </xsl:choose>

For text, I would use the code posted by Michael Kay earlier in the thread.

Any suggestions?

Nadia Swaby



                                                                                                                             
                      David Carlisle                                                                                         
                      <davidc@xxxxxxxx         To:      xsl-list@xxxxxxxxxxxxxxxxxxxxxx                                      
                      k>                       cc:                                                                           
                                               Subject: Re:  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
________________________________________________________________________

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.