我在这里很困惑为什么resource
标签仍然在里面<body>
,因为我认为默认模板ltx:resource
应该让它出现。
我的 XML 文件为:
<?xml version="1.0" encoding="UTF-8"?>
<?latexml RelaxNGSchema="LaTeXML"?>
<document xmlns="http://dlmf.nist.gov/LaTeXML" xmlns:stex="http://kwarc.info/ns/sTeX" xml:id="Document">
<resource src="LaTeXML.css" type="text/css"/>
<resource src="ltx-article.css" type="text/css"/>
<para class="theory" xml:id="p1" fragid="p1">
<block class="definition" xml:id="foo" fragid="foo">
<p xml:id="foo.p1" about="#foo.p1" stex:srcref="/Users/yuancalvin/lmh/localmh/ext/sTeX/htmltest/test.tex#textrange(from=9;0,to=11;16)" fragid="foo.p1">
testing
</p>
</block>
</para>
</document>
XSL 中负责构建的部分如下:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
version = "1.0"
xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
xmlns:ltx = "http://dlmf.nist.gov/LaTeXML"
xmlns:string= "http://exslt.org/strings"
xmlns:f = "http://dlmf.nist.gov/LaTeXML/functions"
exclude-result-prefixes = "ltx f"
extension-element-prefixes="string f">
<xsl:template match="/" mode="head-resources">
<xsl:apply-templates select="//ltx:resource[@type='text/css']
| //ltx:resource[@type='text/javascript']" mode="inhead"/>
</xsl:template>
<!-- By default, these disappear -->
<xsl:template match="ltx:resource"/>
<xsl:template match="ltx:resource[@type='text/css' and @src]" mode="inhead">
<xsl:text>
</xsl:text>
<xsl:element name="link" namespace="{$html_ns}">
<xsl:attribute name="rel">stylesheet</xsl:attribute>
<xsl:attribute name="href"><xsl:value-of select="f:url(@src)"/></xsl:attribute>
<xsl:attribute name="type"><xsl:value-of select="@type"/></xsl:attribute>
<xsl:if test="@media">
<xsl:attribute name="media"><xsl:value-of select="@media"/></xsl:attribute>
</xsl:if>
</xsl:element>
</xsl:template>
<xsl:template match="/" mode="body-main-begin"/>
<xsl:template match="/" mode="body-main-end"/>
<xsl:template match="/" mode="body-content">
<xsl:text>
</xsl:text>
<xsl:element name="div" namespace="{$html_ns}">
<xsl:attribute name="class">ltx_page_content</xsl:attribute>
<xsl:apply-templates select="." mode="body-content-begin"/>
<xsl:apply-templates/>
<xsl:apply-templates select="." mode="body-content-end"/>
<xsl:text>
</xsl:text>
</xsl:element>
</xsl:template>
<xsl:template match="/" mode="body-content-begin"/>
<xsl:template match="/" mode="body-content-end"/>
</xsl:stylesheet>
样式表仍然不完整,因为实际的样式表相当长,但应该足以进行错误检查。
<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title/>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8"/>
<link rel="stylesheet" href="LaTeXML.css" type="text/css"/>
<link rel="stylesheet" href="ltx-article.css" type="text/css"/>
</head>
<body>
<div class="ltx_page_main">
<div class="ltx_page_content">
<resource xmlns="http://dlmf.nist.gov/LaTeXML" src="LaTeXML.css" type="text/css"/>
<resource xmlns="http://dlmf.nist.gov/LaTeXML" src="ltx-article.css" type="text/css"/>
<para xmlns="http://dlmf.nist.gov/LaTeXML" class="theory" xml:id="p1">
<block class="definition" xml:id="foo">
<p xmlns:stex="http://kwarc.info/ns/sTeX" xml:id="foo.p1" about="#foo.p1" stex:srcref="/Users/yuancalvin/lmh/localmh/ext/sTeX/htmltest/test.tex#textrange(from=9;0,to=11;16)">
testing </p>
</block>
</para>
</div>
<div class="ltx_page_footer">
<div class="ltx_page_logo">Generated by <a href="http://dlmf.nist.gov/LaTeXML/">LaTeXML <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAAOCAYAAAD5YeaVAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9wKExQZLWTEaOUAAAAddEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIFRoZSBHSU1Q72QlbgAAAdpJREFUKM9tkL+L2nAARz9fPZNCKFapUn8kyI0e4iRHSR1Kb8ng0lJw6FYHFwv2LwhOpcWxTjeUunYqOmqd6hEoRDhtDWdA8ApRYsSUCDHNt5ul13vz4w0vWCgUnnEc975arX6ORqN3VqtVZbfbTQC4uEHANM3jSqXymFI6yWazP2KxWAXAL9zCUa1Wy2tXVxheKA9YNoR8Pt+aTqe4FVVVvz05O6MBhqUIBGk8Hn8HAOVy+T+XLJfLS4ZhTiRJgqIoVBRFIoric47jPnmeB1mW/9rr9ZpSSn3Lsmir1fJZlqWlUonKsvwWwD8ymc/nXwVBeLjf7xEKhdBut9Hr9WgmkyGEkJwsy5eHG5vN5g0AKIoCAEgkEkin0wQAfN9/cXPdheu6P33fBwB4ngcAcByHJpPJl+fn54mD3Gg0NrquXxeLRQAAwzAYj8cwTZPwPH9/sVg8PXweDAauqqr2cDjEer1GJBLBZDJBs9mE4zjwfZ85lAGg2+06hmGgXq+j3+/DsixYlgVN03a9Xu8jgCNCyIegIAgx13Vfd7vdu+FweG8YRkjXdWy329+dTgeSJD3ieZ7RNO0VAXAPwDEAO5VKndi2fWrb9jWl9Esul6PZbDY9Go1OZ7PZ9z/lyuD3OozU2wAAAABJRU5ErkJggg==" alt="[LOGO]"/></a></div></div>
</div>
</body>
</html>
我真的不知道为什么资源标签仍然存在于正文中。任何帮助将不胜感激:)