Custom XSL: Is there a way to wrap the content?

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

Custom XSL: Is there a way to wrap the content?

by Dominic :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I want to create a custom XSL to wrap my generated html content by a div. I need this for the display.

With this...

<?xml version="1.0" encoding="UTF-8"?>
<?oxygen RNGSchema=MailScanner soupçonne le lien suivant d'être une tentative de fraude de la part de "www.oasis-open.org"  "http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng" type="xml"?>
<article xmlns=MailScanner soupçonne le lien suivant d'être une tentative de fraude de la part de "docbook.org"  "http://docbook.org/ns/docbook"
    xmlns:xlink=MailScanner soupçonne le lien suivant d'être une tentative de fraude de la part de "www.w3.org"  "http://www.w3.org/1999/xlink" version="5.0">
    <info>
        <title>Article Template Title</title>
    </info>
    <section>
        <title>Section1 Title</title>
        <para>Text</para>
    </section>
</article>

I want to generate this

<html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Article Template Title</title>
    <meta name="generator" content="DocBook XSL-NS Stylesheets V1.75.1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">

<div class="my_added_div">								<-----------
    <div class="article" title="Article Template Title">
        <div class="titlepage">
            <div>
                <div>
                    <h1 class="title"><a name="d0e2"></a>Article Template Title</h1>
                </div>
            </div>
            <hr>
        </div>
        <div class="section" title="Section1 Title">
            <div class="titlepage">
                <div>
                    <div>
                        <h2 class="title" style="clear: both"><a name="d0e6"></a>Section1 Title</h2>
                    </div>
                </div>
            </div>
            <p>Text</p>
        </div>
    </div>

</div>                      								<-----------
</body>
</html>

I cannot do that with the Templates for HTML headers and footers.

My dream is to do...

<xsl:template name="user.body.content">
    <div class="my_added_div">
       <xsl:apply-templates />
    </div>
</xsl:template>


Is there a way to wrap the content?

Thanks

Dominic

Re: Custom XSL: Is there a way to wrap the content?

by Bob Stayton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hi,
Yes, you can wrap the content, but it will require customizing the existing template that outputs <body>.
 
If you are doing chunked output, then you want to customize the template named 'chunk-element-content' in html/chunk-common.xsl.
 
If you are doing non-chunked output, then you need to customize the template with match="*" mode="process.root" in html/docbook.xsl.
 
In each of those you can see the start and end tags for <body> so you can put your div tags in the appropriate place to wrap all the content.
 
Bob Stayton
Sagehill Enterprises
bobs@...
 
 
----- Original Message -----
Sent: Monday, August 17, 2009 2:22 PM
Subject: [docbook] Custom XSL: Is there a way to wrap the content?

Hello,

I want to create a custom XSL to wrap my generated html content by a div. I need this for the display.

With this...

<?xml version="1.0" encoding="UTF-8"?>
<?oxygen RNGSchema=MailScanner soupçonne le lien suivant d'être une tentative de fraude de la part de "www.oasis-open.org"  "http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng" type="xml"?>
<article xmlns=MailScanner soupçonne le lien suivant d'être une tentative de fraude de la part de "docbook.org"  "http://docbook.org/ns/docbook"
    xmlns:xlink=MailScanner soupçonne le lien suivant d'être une tentative de fraude de la part de "www.w3.org"  "http://www.w3.org/1999/xlink" version="5.0">
    <info>
        <title>Article Template Title</title>
    </info>
    <section>
        <title>Section1 Title</title>
        <para>Text</para>
    </section>
</article>

I want to generate this

<html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Article Template Title</title>
    <meta name="generator" content="DocBook XSL-NS Stylesheets V1.75.1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">

<div class="my_added_div">								<-----------
    <div class="article" title="Article Template Title">
        <div class="titlepage">
            <div>
                <div>
                    <h1 class="title"><a name="d0e2"></a>Article Template Title</h1>
                </div>
            </div>
            <hr>
        </div>
        <div class="section" title="Section1 Title">
            <div class="titlepage">
                <div>
                    <div>
                        <h2 class="title" style="clear: both"><a name="d0e6"></a>Section1 Title</h2>
                    </div>
                </div>
            </div>
            <p>Text</p>
        </div>
    </div>

</div>                      								<-----------
</body>
</html>

I cannot do that with the Templates for HTML headers and footers.

My dream is to do...

<xsl:template name="user.body.content">
    <div class="my_added_div">
       <xsl:apply-templates />
    </div>
</xsl:template>


Is there a way to wrap the content?

Thanks

Dominic