Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="utf-8"?>
- <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ntw="Number2Word.uri" exclude-result-prefixes="ntw">
- <xsl:output method="html"/>
- <xsl:variable name="ThisDocument" select="document('')"/>
- <xsl:variable name="chapn">
- <xsl:value-of select="toc-div/toc-item/toc-title"/>
- </xsl:variable>
- <xsl:template match="/">
- <xsl:text disable-output-escaping="yes"><![CDATA[<!DOCTYPE html>]]></xsl:text>
- <html>
- <head>
- <xsl:text disable-output-escaping="yes"><![CDATA[</meta>]]></xsl:text>
- <title>
- <!--TABLE OF Contents-->
- <xsl:value-of select="toc/title"/>
- </title>
- <link rel="stylesheet" href="C:\Users\u0138039\Desktop\Proview\HK\Business Law in Hong Kong\Source\XSLT\main.css" type="text/css"/><xsl:text disable-output-escaping="yes"><![CDATA[</link>]]></xsl:text>
- </head>
- <body>
- <section class="tr_toc">
- <xsl:apply-templates/>
- </section>
- </body>
- </html>
- </xsl:template>
- <xsl:template match="toc">
- <div class="toc">
- <a name="BLHK_TOC_01"></a>
- <div class="toc-title">
- <xsl:value-of select="title" />
- </div>
- <xsl:for-each select="toc-part/toc-div[1]/toc-item">
- <table>
- <tbody class="toc-frontitem">
- <tr>
- <td class="toc-title">
- <span class="content-style font-style-italic">
- <xsl:value-of select="./toc-title"/>
- </span>
- </td>
- <td class="toc-pg">
- <span class="content-style font-style-italic">
- <xsl:value-of select="./toc-pg"/>
- </span>
- </td>
- </tr>
- </tbody>
- </table>
- </xsl:for-each>
- <xsl:apply-templates select="toc-part/toc-div/title"/>
- </div>
- </xsl:template>
- <xsl:template match="toc-part/toc-div/title">
- <table class="toc-div">
- <tbody>
- <tr>
- <td>
- <xsl:apply-templates select="../toc-item"/>
- </td>
- </tr>
- </tbody>
- </table>
- </xsl:template>
- <xsl:template match="chapter" mode="x">
- <xsl:if test="$chapn=toc-part/toc-div/toc-item/toc-title">
- <xsl:value-of select="toc-part/toc-div/toc-item/toc-title"/>
- </xsl:if>
- </xsl:template>
- <xsl:template match="toc-item">
- <xsl:variable name="prent">
- <xsl:value-of select="substring-before(substring-after(../title,' '),' ')"/>
- </xsl:variable>
- <xsl:variable name="tex">
- <xsl:value-of select="./toc-title/text()"/>
- </xsl:variable>
- <xsl:variable name="cha">
- <xsl:value-of select="$prent"/>
- </xsl:variable>
- <xsl:variable name="get_tit">
- <xsl:value-of select="document(concat('C:\Documents and Settings\u0138039\Desktop\Proview\HK\Business Law in Hong Kong\Source\Business Law in Hong Kong/Chapter ',$cha,'.xml'))/chapter/toc/toc-part/toc-div/toc-item/toc-title/text()"/>
- </xsl:variable>
- <xsl:variable name="match">
- <xsl:if test="document(concat('C:\Documents and Settings\u0138039\Desktop\Proview\HK\Business Law in Hong Kong\Source\Business Law in Hong Kong/Chapter ',$cha,'.xml'))/chapter/toc/toc-part/toc-div/toc-item/toc-title/text() = ./toc-title/text()">
- <xsl:apply-templates select="document(concat('C:\Documents and Settings\u0138039\Desktop\Proview\HK\Business Law in Hong Kong\Source\Business Law in Hong Kong/Chapter ',$cha,'.xml'))/chapter" mode="x"/>
- </xsl:if>
- </xsl:variable>
- <div class="a">
- <xsl:value-of select="$get_tit"/>
- </div>
- <div class="b">
- <xsl:value-of select="$match"/>
- </div>
- <!--
- <xsl:value-of select="."/>
- -->
- <xsl:value-of select="$prent"/>
- <table class="toc-item">
- <tbody>
- <tr>
- <xsl:choose>
- <xsl:when test="contains(./toc-title,'CHAPTER')">
- <td class="toc-title">
- <xsl:value-of select="concat('CHAPTER ',substring-before(substring-after(./toc-title,' '),' '))" />
- <xsl:text>            </xsl:text>
- <xsl:value-of select="substring-after(substring-after(./toc-title,' '),' ')"/>
- </td>
- </xsl:when>
- <xsl:when test="contains(./toc-title,'Chapter')">
- <td class="toc-title">
- <xsl:value-of select="concat('CHAPTER ',substring-before(substring-after(./toc-title,' '),' '))" />
- <xsl:text>            </xsl:text>
- <xsl:value-of select="substring-after(substring-after(./toc-title,' '),' ')"/>
- </td> </xsl:when>
- <xsl:otherwise>
- <td class="toc-title">
- <xsl:value-of select="normalize-space(current()/toc-title)" />
- </td>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="(contains(current()/toc-subitem[1]/toc-title,'Appendix '))">
- <td class="toc-pg">
- <span class="font-style-italic">
- <xsl:value-of select="current()/toc-subitem[1]/toc-title"/></span>
- </td> </xsl:when>
- <xsl:otherwise>
- </xsl:otherwise>
- </xsl:choose>
- </tr>
- </tbody>
- </table>
- <xsl:apply-templates select="toc-subitem"/>
- </xsl:template>
- <xsl:template match="toc-subitem">
- <xsl:variable name="prent">
- <xsl:value-of select="substring-before(substring-after(../../title,' '),' ')"/>
- </xsl:variable>
- <xsl:value-of select="$prent"/>
- <table class="toc-third-level">
- <td><xsl:value-of select="./toc-title"/></td>
- </table>
- </xsl:template>
- </xsl:stylesheet>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement