0

xslt を使用して、epub v3 ファイルの TOC.xhtml を解析したいと考えています。これまでのところ、私の xsl ファイルには次のものがあります。

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns="http://www.w3.org/1999/xhtml"
        xmlns:epub="http://www.idpf.org/2007/ops">
    <xsl:template match="/">
        <div id="tocItems">      
            <xsl:apply-templates select="/epub:html/epub:body/epub:nav/epub:ol/epub:li" />
        </div> 
    </xsl:template>

    <xsl:template match="epub:li">
        <br />
        hello
        <button class="option" onclick="parent.loadHREF(this)">                     
            <xsl:attribute name="id">
                <xsl:value-of select="epub:a/@href" />
            </xsl:attribute>
            <xsl:attribute name="name">
                <xsl:value-of select='position()' />
            </xsl:attribute>
            <xsl:value-of select="epub:a" />
        </button>
    </xsl:template>

</xsl:stylesheet>

残念ながら、これは出力を与えません。これは典型的な TOC.xhtml ファイルです。誰かが助けてくれることを願っています。

 <?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="tableofcontentsV3.xsl"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">
  <head>
    <meta http-equiv="default-style" content="text/html; charset=utf-8"/>
    <title>Contents</title>
    <link rel="stylesheet" href="css/famouspaintings.css" type="text/css"/>
  </head>
  <body>

<nav epub:type="toc"><h2>Contents</h2>
  <ol epub:type="list"><li><a href="s001-Cover-01.xhtml">Cover</a></li>
<li><a href="s002-BookTitlePage-01.xhtml">Famous Paintings</a></li>
<li><a href="s003-Copyright-01.xhtml">Copyright</a></li>
<li><a href="s004-Section-001.xhtml">Explore</a></li>
<li><a href="s005-Section-002.xhtml">Famous Paintings</a></li>
<li><a href="s018-Section-009.xhtml">Colophon</a></li>
</ol></nav></body>
</html>
4

1 に答える 1