Table Auto numbering template fails with namespaces but is fine otherwise

View: New views
3 Messages — Rating Filter:   Alert me  

Table Auto numbering template fails with namespaces but is fine otherwise

by Carlton Joseph :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Folks,

I have two question.
1 - Why does my table auto-numbering scheme not work with namespaces
2 - Is the way I do table numbering the recommended method

xsltproc -o test.html html.xsl test.dbk
works and generates tables numbers

xsltproc -o test_ns.html html_ns.xsl test.dbk
no table numbers are generated.

My file are at the end of this email.

I am guessing my template need to be specified with the namespace
and I do not know how to do that.

Thanks for your help in advance,
Carlton.

===test.dbk============================================
<?xml version="1.0" encoding="UTF-8"?>
<article
        xmlns="http://docbook.org/ns/docbook"
        version="5.0"
        xmlns:xi="http://www.w3.org/2001/XInclude"
>

<title>Table Numbering - <?ns?></title>

<table frame="box" rules="all">
        <thead><tr><th>Step</th><th>Action</th></tr></thead>
        <tr><td><?count?></td><td>Do A.</td></tr>
        <tr><td xml:id="loop"><?count?></td><td>Do B.</td></tr>
        <tr><td><?count?></td><td>Do C.</td></tr>
        <tr><td><?count?></td><td>Goto step <xref linkend="loop"
endterm="loop"/></td></tr>
</table>

</article>
===html_common.xsl========================================
<?xml version='1.0'?>
<xsl:stylesheet
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0"
>

<xsl:template match="processing-instruction('count')">
    <xsl:number count="tr" format="1" />
</xsl:template>

</xsl:stylesheet>
===html.xsl==============================================
<?xml version='1.0'?>
<xsl:stylesheet
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0"
>

<xsl:import href="../../docbook-xsl-1.75.1/xhtml/docbook.xsl"/>
<xsl:import href="html_common.xsl"/>
<xsl:template match="processing-instruction('ns')">No-NS</xsl:template>

</xsl:stylesheet>
===html_ns.xsl============================================
<?xml version='1.0'?>
<xsl:stylesheet
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0"
>

<xsl:import href="../../docbook-xsl-ns-1.75.1/xhtml/docbook.xsl"/>
<xsl:import href="html_common.xsl"/>
<xsl:template match="processing-instruction('ns')">NS</xsl:template>

</xsl:stylesheet>

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@...
For additional commands, e-mail: docbook-apps-help@...


Re: Table Auto numbering template fails with namespaces but is fine otherwise

by Bob Stayton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Carlton,
Indeed, namespace is the issue. The element tr in  that you reference in
<xsl:number count="tr" format="1" />
needs its namespace prefix (and the stylesheet needs the namespace
declaration for that prefix). That means you need to copy that template from
html_common.xsl to html_ns.xsl so you can add the namespace there.

Bob Stayton
Sagehill Enterprises
bobs@...


----- Original Message -----
From: "Carlton Joseph" <carlton.joseph@...>
To: <docbook-apps@...>
Sent: Monday, June 15, 2009 3:55 PM
Subject: [docbook-apps] Table Auto numbering template fails with namespaces
but is fine otherwise


> Hello Folks,
>
> I have two question.
> 1 - Why does my table auto-numbering scheme not work with namespaces
> 2 - Is the way I do table numbering the recommended method
>
> xsltproc -o test.html html.xsl test.dbk
> works and generates tables numbers
>
> xsltproc -o test_ns.html html_ns.xsl test.dbk
> no table numbers are generated.
>
> My file are at the end of this email.
>
> I am guessing my template need to be specified with the namespace
> and I do not know how to do that.
>
> Thanks for your help in advance,
> Carlton.
>
> ===test.dbk============================================
> <?xml version="1.0" encoding="UTF-8"?>
> <article
> xmlns="http://docbook.org/ns/docbook"
> version="5.0"
> xmlns:xi="http://www.w3.org/2001/XInclude"
>>
>
> <title>Table Numbering - <?ns?></title>
>
> <table frame="box" rules="all">
> <thead><tr><th>Step</th><th>Action</th></tr></thead>
> <tr><td><?count?></td><td>Do A.</td></tr>
> <tr><td xml:id="loop"><?count?></td><td>Do B.</td></tr>
> <tr><td><?count?></td><td>Do C.</td></tr>
> <tr><td><?count?></td><td>Goto step <xref linkend="loop"
> endterm="loop"/></td></tr>
> </table>
>
> </article>
> ===html_common.xsl========================================
> <?xml version='1.0'?>
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0"
>>
>
> <xsl:template match="processing-instruction('count')">
>    <xsl:number count="tr" format="1" />
> </xsl:template>
>
> </xsl:stylesheet>
> ===html.xsl==============================================
> <?xml version='1.0'?>
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0"
>>
>
> <xsl:import href="../../docbook-xsl-1.75.1/xhtml/docbook.xsl"/>
> <xsl:import href="html_common.xsl"/>
> <xsl:template match="processing-instruction('ns')">No-NS</xsl:template>
>
> </xsl:stylesheet>
> ===html_ns.xsl============================================
> <?xml version='1.0'?>
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0"
>>
>
> <xsl:import href="../../docbook-xsl-ns-1.75.1/xhtml/docbook.xsl"/>
> <xsl:import href="html_common.xsl"/>
> <xsl:template match="processing-instruction('ns')">NS</xsl:template>
>
> </xsl:stylesheet>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: docbook-apps-unsubscribe@...
> For additional commands, e-mail: docbook-apps-help@...
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@...
For additional commands, e-mail: docbook-apps-help@...


Re: Table Auto numbering template fails with namespaces but is fine otherwise

by Carlton Joseph :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Bob,

That worked and my modified file follows.

Cheers,
Carlton.

===html_ns.xsl============================================
<?xml version='1.0'?>
<xsl:stylesheet
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:d="http://docbook.org/ns/docbook"
                version="1.0"
>

<xsl:import href="../../docbook-xsl-ns-1.75.1/xhtml/docbook.xsl"/>
<xsl:template match="processing-instruction('ns')">NS</xsl:template>
<xsl:template match="processing-instruction('count')">
    <xsl:number count="d:tr" format="1" />
</xsl:template>

</xsl:stylesheet>
=======================================================

On Tue, Jun 16, 2009 at 10:44 AM, Bob Stayton<bobs@...> wrote:

> Hi Carlton,
> Indeed, namespace is the issue. The element tr in  that you reference in
> <xsl:number count="tr" format="1" />
> needs its namespace prefix (and the stylesheet needs the namespace
> declaration for that prefix). That means you need to copy that template from
> html_common.xsl to html_ns.xsl so you can add the namespace there.
>
> Bob Stayton
> Sagehill Enterprises
> bobs@...
>
>
> ----- Original Message ----- From: "Carlton Joseph"
> <carlton.joseph@...>
> To: <docbook-apps@...>
> Sent: Monday, June 15, 2009 3:55 PM
> Subject: [docbook-apps] Table Auto numbering template fails with namespaces
> but is fine otherwise
>
>
>> Hello Folks,
>>
>> I have two question.
>> 1 - Why does my table auto-numbering scheme not work with namespaces
>> 2 - Is the way I do table numbering the recommended method
>>
>> xsltproc -o test.html html.xsl test.dbk
>> works and generates tables numbers
>>
>> xsltproc -o test_ns.html html_ns.xsl test.dbk
>> no table numbers are generated.
>>
>> My file are at the end of this email.
>>
>> I am guessing my template need to be specified with the namespace
>> and I do not know how to do that.
>>
>> Thanks for your help in advance,
>> Carlton.
>>
>> ===test.dbk============================================
>> <?xml version="1.0" encoding="UTF-8"?>
>> <article
>> xmlns="http://docbook.org/ns/docbook"
>> version="5.0"
>> xmlns:xi="http://www.w3.org/2001/XInclude"
>>>
>>
>> <title>Table Numbering - <?ns?></title>
>>
>> <table frame="box" rules="all">
>> <thead><tr><th>Step</th><th>Action</th></tr></thead>
>> <tr><td><?count?></td><td>Do A.</td></tr>
>> <tr><td xml:id="loop"><?count?></td><td>Do B.</td></tr>
>> <tr><td><?count?></td><td>Do C.</td></tr>
>> <tr><td><?count?></td><td>Goto step <xref linkend="loop"
>> endterm="loop"/></td></tr>
>> </table>
>>
>> </article>
>> ===html_common.xsl========================================
>> <?xml version='1.0'?>
>> <xsl:stylesheet
>> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>> version="1.0"
>>>
>>
>> <xsl:template match="processing-instruction('count')">
>>   <xsl:number count="tr" format="1" />
>> </xsl:template>
>>
>> </xsl:stylesheet>
>> ===html.xsl==============================================
>> <?xml version='1.0'?>
>> <xsl:stylesheet
>> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>> version="1.0"
>>>
>>
>> <xsl:import href="../../docbook-xsl-1.75.1/xhtml/docbook.xsl"/>
>> <xsl:import href="html_common.xsl"/>
>> <xsl:template match="processing-instruction('ns')">No-NS</xsl:template>
>>
>> </xsl:stylesheet>
>> ===html_ns.xsl============================================
>> <?xml version='1.0'?>
>> <xsl:stylesheet
>> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>> version="1.0"
>>>
>>
>> <xsl:import href="../../docbook-xsl-ns-1.75.1/xhtml/docbook.xsl"/>
>> <xsl:import href="html_common.xsl"/>
>> <xsl:template match="processing-instruction('ns')">NS</xsl:template>
>>
>> </xsl:stylesheet>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: docbook-apps-unsubscribe@...
>> For additional commands, e-mail: docbook-apps-help@...
>>
>>
>>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@...
For additional commands, e-mail: docbook-apps-help@...