Re: [docbook-apps] Starting question: Customization for a new element

From
"Cob Rtayton"
Date
2010-06-10T15:35:08+00:00
ID
01fb01cb08b2$76d56ad0$6600a8c0@pazu
Thread
Re: [docbook-apps] Starting question: Customization for a new element
Hi,

It appears that your documents are DocBook 5, since 
the error message indicates that the html element is in that namespace.  
From the xsl:import statement, I can't tell if the stylesheets are the namespace 
version or not. I presume you are, otherwise you would not get that error 
message.

 

You just need to add the namespace declaration and 
prefix to your stylesheet.  Without it, your match is on an element named 
'html' but in no namespace, so it does not match.  See this reference for 
details.

 

http://www.sagehill.net/docbookxsl/CustomDb5Xsl.html

 

Bob Stayton
Sagehill Enterprises


 

 

  
----- Original Message ----- 

  
From: 
  Fabien 
  Tillier 

  
To:  
  

  
Sent: Thursday, June 10, 2010 7:00 
  AM

  
Subject: [docbook-apps] Starting 
  question: Customization for a new element

  

  

  
Hi List.

  
I am trying to write a simple 
  customization to treat my XML.

  
I added an <html> tag to the XML 
  file I am using to handle HTML inserted as CDATA (see below) for a 
  bibliographic reference.

  
<author>

  
<othername>

  
<html><![CDATA[

  
 

  
      
  <span style="color: #000000; font-size: 10pt; font-family: Times New 
  Roman">

  
 

  
        
  <b>LUKAS, R.J. (1986)</b>

  
 

  
      
  </span>

  
 

  
    
  ]]></html>

  
</othername>

  
</author>

  
 

  
So my simple customization is a 
  below

  
 

  
<?xml 
  version='1.0' 
  encoding="UTF-8"?>

  
<!-- 
  Template to convert DocBook XML to HTML --> 
  

  
<xsl:stylesheet version="1.0"

  
    
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  
    
    <xsl:import href=""docBook/xsl/html/docbook.xsl"/>

  
    
    <xsl:output method="html"/>

  
    
    <xsl:param name="html.stylesheet" select="'corpstyle.css'"/> 

  
      
  <xsl:param name="admon.graphics" select="1"/>

  
      
  <xsl:template match="html">

  
            
  <xsl:value-of select="." disable-output-escaping="yes"/>

  
      
  </xsl:template>         
  

  
 </xsl:stylesheet>

  
 

  
I can call it but I have errors 
  like

  
Element html in namespace 
  'http://docbook.org/ns/docbook' encountered in title, but no template 
  matches.

  
 

  
To check, I renamed my <html> 
  element to something uncommon with plenty of other characters and number, but 
  it is the same (it was to avoid using an potentially already used element, 
  after all <html> is a pretty common tag…)

  
 

  
Still, my template is not 
  used…

  
I am pretty sure I have not caught 
  something, though I now have some of the finest books on the docbook and XSL 
  stylesheets available (including the DocBook XSL one).

  
 

  
Oh, and the template work. If I use it 
  simply without calling the xsl stylesheets (removing the import) my tags are 
  treated and appear as expected in the generated HTML.

  
 

  
Thanks in advance for any 
  help…

  
 

  
Best regards,

  
Fabien