OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-tc message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-tc] Re: DocBook Technical Committee Meeting Minutes:16 January 2008


On 1/25/08 12:00 PM, Norman Walsh wrote:
> | Simple XSLT can accept|delete proposed changes.
> 
> <para>Really? You think you need tools
> to do that?</para>
> 
> Er. No, what I meant to say was:
> 
> <para revisionflag="changed">
> <phrase revisionflag="changed">Right. I</phrase> think you
> <phrase revisionflag="added">already have the tools you</phrase> need 
> <phrase revisionflag="deleted">tools</phrase>
> to do that<phrase revisionflag="changed">!</phrase></para>

Phrases and not annotations, OK (duh, I guess).

So, like so?

$ xsltproc -o example.html changes.xsl added.xml

$ cat added.xml

<para revisionflag="changed">
<phrase revisionflag="changed">Right. I</phrase> think you
<phrase revisionflag="added">already have the tools you</phrase> need
<phrase revisionflag="deleted">tools</phrase>
to do that<phrase revisionflag="changed">!</phrase></para>

$ cat changes.xsl
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
                xmlns="http://www.w3.org/1999/xhtml";
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:output method="xml"
              encoding="UTF-8"
              indent="no"
              doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
              doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>

  <xsl:template match="/">
    <html lang="en" xml:lang="en">
      <head>
        <title>A changing text test</title>
        <style type="text/css">
<![CDATA[
.blockchanged {
  border-right: medium solid blue;
}
.changed {
  color: blue;
}
.deleted {
  color: red;
  text-decoration: line-through;
}
.added {
  color: gray;
}
]]>
        </style>
      </head>
      <body>
        <div>
          <xsl:apply-templates select="@*|node()"/>
        </div>
      </body>
    </html>
  </xsl:template>
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="para">
    <p><xsl:apply-templates select="@*|node()"/></p>
  </xsl:template>
  <xsl:template match="phrase">
    <span><xsl:apply-templates select="@*|node()"/></span>
  </xsl:template>

  <xsl:template match="@revisionflag">
    <xsl:attribute name="class">
      <xsl:choose>
        <!-- or other block elements -->
        <xsl:when test="parent::para">
          <xsl:value-of select="concat('block', .)"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="."/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:attribute>
  </xsl:template>

</xsl:stylesheet>

$ cat example.html
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml"; lang="en" xml:lang="en"><head><meta
http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>A changing
text test</title><style type="text/css">

.blockchanged {
  border-right: medium solid blue;
}
.changed {
  color: blue;
}
.deleted {
  color: red;
  text-decoration: line-through;
}
.added {
  color: gray;
}

        </style></head><body><div><p class="blockchanged">
<span class="changed">Right. I</span> think you
<span class="added">already have the tools you</span> need
<span class="deleted">tools</span>
to do that<span class="changed">!</span></p></div></body></html>


Keith

PNG image



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]