"Carlos Sanchez" <[EMAIL PROTECTED]> writes:

>> But, what about folks (like me) who are using the original 
>> docbook plugin for docbook->xdoc conversion?  I guess I could 
>> change all my project files to reference the new name.  
>> (Wouldn't bother me too much, I guess.)
>
> Hi,
>
> I think we can add the current docbook goals to the sdocbook plugin, they are 
> only few lines.

hi,

another option can be to do: docbook->xhtml->xdoc
where the first step is using the docbook-xsl stylesheets for xhtml,
and the second step is performed by a small stylesheet (see below). 

i'm using this to render my docbook documents "inside" the
maven-generated website layout. For an example, based on the sdocbook
samples, please see:
http://www.pvv.org/~jb/software/sdocbook/4SuiteCVS.html

i've uploaded a patch for this at sourceforge, see:
http://sourceforge.net/tracker/index.php?func=detail&aid=1096038&group_id=61626&atid=497855
it adds two new goals: sdocbook:generate-xhtml and sdocbook:generate-xdoc

best regards,
-j�rgen


in case it might be useful for anyone, the stylesheet for xhtml->xdoc is:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:transform version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";  
 xmlns:xhtml="http://www.w3.org/1999/xhtml"; >

  <xsl:output method="xml" indent="yes" />
  <xsl:strip-space elements="*" />

  <!-- xdoc is mostly an xhtml document wrapped inside a DOCUMENT tag -->
  <xsl:template match="/">
    <document>
      <xsl:apply-templates /> 
    </document>
  </xsl:template>

  <!-- all tags in the input xhtml document have the 'xhtml' namespace-->
  <xsl:template match="xhtml:html" >
      <xsl:apply-templates /> 
  </xsl:template>

  <!-- Discard everything inside the xhtml HEAD tag -->
  <xsl:template match="xhtml:head" />

  <!-- The xhtml BODY shall be wrapped in a SECTION tag.   -->
  <xsl:template match="xhtml:body" >
    <body>
      <section>
      <xsl:apply-templates mode="discardnamespace" />  <!-- using a
  mode template to match all children of BODY -->
      </section>
    </body>
  </xsl:template>

  <!-- for all tags (under BODY), strip the namespace prefix -->
  <xsl:template mode="discardnamespace" match="xhtml:*">
    <xsl:element name="{local-name(.)}">
      <xsl:copy-of select="@*[local-name() != 'xmlns']" />
      <xsl:apply-templates mode="discardnamespace"/> <!-- apply
  recursively -->
    </xsl:element>
  </xsl:template>

  <!-- this one matches all tags with spurious xmlns='' that
  docbook-xsl created
   |   (see
  
http://sourceforge.net/tracker/index.php?func=detail&aid=1061942&group_id=21935&atid=373747),
   |   as the previous template will not get those.
  -->
  <xsl:template mode="discardnamespace" match="*[namespace-uri()='']">
    <xsl:element name="{local-name(.)}">
      <xsl:copy-of select="@*[local-name() != 'xmlns']" />
      <xsl:apply-templates mode="discardnamespace"/> <!-- apply
    recursively -->
    </xsl:element>
  </xsl:template>

</xsl:transform>

-- 
j�rgen binningsb�                              in steepness is safety      
                                                     - w. c. slingsby           
      
mobile: (+47) 40 47 38 11 
web:    www.pvv.org/~jb


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to