Next in thread → Next in month →

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

From
"Gabien Sillier"
Date
2010-06-10T15:47:23+00:00
ID
Thread
RE: [docbook-apps] Starting question: Customization for a new element
You are the man….

<xsl:stylesheet version="1.0"

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

      xmlns:d="http://docbook.org/ns/docbook" exclude-result-prefixes="d" >

      <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="d:html">

 

Now, it works !

Thanks,

Regards,

Fabien

 

 

De : Bob Stayton
[mailto:] 

Envoyé : jeudi 10 juin 2010 17:35

À : Fabien Tillier; 

Objet : 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
Next in thread → Next in month →