xsl-list
[Top] [All Lists]

Brake-up a big XHTML document into pages using 2 stylesheets

2003-03-18 06:49:35

Hi,

I have a big XHTML document and i am trying to brake it up into pages. I have astylesheet (one.xsl) wich produce a header and a footer for the page, as well as some contents and photos.

My XHTML looks like:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="one.xsl" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
</head>
        <body>
                <div>
                        <img src="image"/>
                </div>
                <h1>Title</h1>

                <div class="section">
                        <h2>Welcome</h2>
                        <p>text</p>
                        <p>text</p>
                </div>
              <div class="section">
                        <h2><a href="http://www.mypage.html";>Mypage</a>
                        </h2>
                </div>

               <div class="section">
                        <h2>People</h2>
                        <p>text</p>
                        <p>text</p>
                </div>
</body>
</html>

With the one.xsl i crate a TOC containing all the h2 as internal and external links. The code is:
<ul>
<xsl:for-each select="//xhtml:div[(_at_)class='section']/xhtml:h2">
<li>
<xsl:choose>
<xsl:when test="./xhtml:a">
<xsl:copy-of select="./xhtml:a"/>
</xsl:when>
<xsl:otherwise>
<a href="#{generate-id()}">
<xsl:value-of select="."/>
</a>
</xsl:otherwise>
</xsl:choose>

Now i create an other stylesheet (brake.xsl) containing the standart header and footer that i whant its pageto have and the code to peack-up the h2 and crate a page with its one.


<xsl:stylesheet>
<xsl:template name="brake">
header....code
<xsl:template match="//div[(_at_)class='section'][$page_number]//h2">
5. <xsl:value-of select="*">
</xsl:value-of>
<xsl:apply-templates />
</xsl:template>

footer...code
</xsl:templte>
</xsl:stylesheet>

The problen now is that i have to use this string [$page_number] in order the end user to choose the page that he want.

I came up with something like that:
<xsl:if test="//div[(_at_)class='section']/h2=$page_number">
<xsl:param name="page_number" select="5" />
</xsl:if>

but it doesn't work.
I don't know where to declare this parameter and how.
Any help will be grate.

Regards
Leon

_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail


XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>
  • Brake-up a big XHTML document into pages using 2 stylesheets, Leonidas Kanellos <=