xsl-list
[Top] [All Lists]

Re: Revision Marking in HTML

2005-05-03 10:11:46

I changed it back to the old way (if it ain't broke, don't fix it!) 

this is not unreasonable

Thanks for all your help.  I hope know one feels like I wasted their time.


not at all, just to round the thread off for the sake of the archives,
here's the original key method, tested a bit:

nadia.xml


<section>
      <heading>Head</heading>
      <para>Some Text</para>
      <?xm-insertion_mark_start author="N. Swaby"
time="20041103T124303-0500"?>
      <list>
            <list.item>
                  <para>More Test</para>
            </list.item>
      </list>
      <?xm-insertion_mark_end ?>
      <figure>
            <graphic file="drm044-f2.jpg" width="606" height="276"/>
            <figtitle>Fig</figtitle>
      </figure>
      <table><!-- table stuff--></table>
      <table><!-- table stuff--></table>
      <table><!-- table stuff--></table>
</section>



nadia.xsl

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                version="1.0">




<xsl:key
   name="pi"
   match="node()"
   
use="generate-id(preceding-sibling::processing-instruction()[starts-with(name(),'xm-insertion_mark_')][1])"/>

<xsl:template match="section">
<div>
<xsl:apply-templates/>
</div>
</xsl:template>

<xsl:template 
match="section[processing-instruction('xm-insertion_mark_start')]">
<div>
<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('pi',generate-id())"/>
</div>
</xsl:for-each>
<xsl:apply-templates 
select="processing-instruction('xm-insertion_mark_end')[last()]/following-sibling::node()"/>
</div>
</xsl:template>

<xsl:template match="section/heading">
<h2>
<xsl:apply-templates/>
</h2>
</xsl:template>

<xsl:template match="list">
<ol>
<xsl:apply-templates/>
</ol>
</xsl:template>
<xsl:template match="list.item">
<li>
<xsl:apply-templates/>
</li>
</xsl:template>

<xsl:template match="para">
<p>
<xsl:apply-templates/>
</p>
</xsl:template>

<xsl:template match="figure|table">
<p> a converted <xsl:value-of select="name()"/>.</p>
</xsl:template>



</xsl:stylesheet>


$ saxon nadia.xml nadia.xsl
<?xml version="1.0" encoding="utf-8"?>
<div>
      <h2>Head</h2>
      <p>Some Text</p>
      <div class="revcontrol">
      <ol>
            <li>
                  <p>More Test</p>
            </li>
      </ol>
      </div>
      <p> a converted figure.</p>
      <p> a converted table.</p>
      <p> a converted table.</p>
      <p> a converted table.</p>
</div>

________________________________________________________________________
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>
--~--



<Prev in Thread] Current Thread [Next in Thread>