질문 :XSL : FO 인라인이 "fo : table"의 유효한 하위가 아닌 이유는 무엇입니까? 이 문제를 어떻게 해결할 수 있습니까?
<?xml version="1.0" encoding="UTF-8"?>
<diffreport>
<css />
<diff>
<table border="1" cellpadding="1" cellspacing="1" style="width:500px">
<caption>This is the table caption</caption>
<tbody>
<tr>
<td>
<span class="diff-html-removed" id="removed-diff-0" previous="first-diff"
changeId="removed-diff-0" next="added-diff-0">one</span>
<span class="diff-html-added" id="added-diff-0" previous="removed-diff-0"
changeId="added-diff-0" next="removed-diff-1">uno</span>
</td>
<td>
<span class="diff-html-removed" id="removed-diff-1" previous="added-diff-0"
changeId="removed-diff-1" next="added-diff-1">two</span>
<span class="diff-html-added" id="added-diff-1" previous="removed-diff-1"
changeId="added-diff-1" next="last-diff">dos</span>
</td>
</tr>
<tr>
<td>three</td>
<td>four</td>
</tr>
</tbody>
</table>
<p />
</diff>
</diffreport>
: I는 다음과 같이 간단한 테이블이있는 문서를 가지고
는 가정 테이블 "FO? :이 오류"FO의 인라인의 유효한 자식이 아닌 XSL "을 해결할 수있는 방법
나는 XSL 만들었습니다. 다음과 같습니다 템플릿 파일 FO을
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="default-page"
page-height="11in" page-width="8.5in" margin-left="0.6in"
margin-right="0.6in" margin-top="0.79in" margin-bottom="0.79in">
<fo:region-body />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="default-page">
<fo:flow flow-name="xsl-region-body">
<fo:block>
<fo:block font-size="180%" font-weight="bold" text-align="center">
<xsl:text>Report</xsl:text>
</fo:block>
<fo:block>
<xsl:apply-templates />
</fo:block>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<!-- xsl report colors -->
<xsl:template match="span[@class='diff-html-added']">
<fo:inline color="green" background-color="#ccffcc">
<xsl:value-of select="." />
</fo:inline>
</xsl:template>
<xsl:template match="span[@class='diff-html-removed']">
<fo:inline color="red" text-decoration="line-through"
background-color="#fdc6c6">
<xsl:value-of select="." />
</fo:inline>
</xsl:template>
<!-- Table -->
<xsl:template match="table">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="tbody">
<fo:table space-before="0.5em" space-after="0.5em"
table-layout="fixed">
<xsl:for-each select="tr[1]/th|tr[1]/td">
<xsl:apply-templates />
</xsl:for-each>
<fo:table-body>
<xsl:apply-templates />
</fo:table-body>
</fo:table>
</xsl:template>
<xsl:template match="tr">
<fo:table-row>
<xsl:if test="@space-before != ''">
<xsl:attribute name="space-before"><xsl:value-of select="@space-before" /></xsl:attribute>
</xsl:if>
<xsl:if test="@class='graybar'">
<xsl:attribute name="background-color">#ddd</xsl:attribute>
</xsl:if>
<xsl:apply-templates />
</fo:table-row>
</xsl:template>
<xsl:template match="th">
<fo:table-cell font-weight="bold" text-align="center">
<xsl:if test="ancestor::table/@border > 0">
<xsl:attribute name="border-style">solid</xsl:attribute>
<xsl:attribute name="border-width">1pt</xsl:attribute>
</xsl:if>
<fo:block>
<xsl:apply-templates />
</fo:block>
</fo:table-cell>
</xsl:template>
<xsl:template match="td">
<fo:table-cell>
<xsl:if test="ancestor::table/@border > 0">
<xsl:attribute name="border-style">solid</xsl:attribute>
<xsl:attribute name="border-width">1pt</xsl:attribute>
</xsl:if>
<fo:block>
<xsl:call-template name="set-alignment" />
<xsl:apply-templates />
</fo:block>
</fo:table-cell>
</xsl:template>
<xsl:template name="set-alignment">
<xsl:choose>
<xsl:when test="@align='left' or contains(@class,'left')">
<xsl:attribute name="text-align">start</xsl:attribute>
</xsl:when>
<xsl:when test="@align='center' or contains(@class,'center')">
<xsl:attribute name="text-align">center</xsl:attribute>
</xsl:when>
<xsl:when test="@align='right' or contains(@class,'right')">
<xsl:attribute name="text-align">end</xsl:attribute>
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
을 나는이 오류 org.apache.fop.fo.ValidationException (오류 알 수없는 위치) 점점 계속 : "{을} 인라인 "은"fo : table "의 유효한 하위가 아닙니다! (사용할 수있는 컨텍스트 정보 없음)
xsl에서이 코드 블록을 제거하면 오류가 사라지지만이 코드가 작동하지 않는 이유를 파악하는 데 도움이 필요합니다.
<xsl:template match="span[@class='diff-html-added']">
<span style="color:green; background-color: #ccffcc;">
<xsl:value-of select="."/></span>
</xsl:template>
인라인이 "fo : table"의 하위가 아닌 이유는 무엇입니까? 내 스팬 클래스가 테이블에서 작동하도록 xsl 템플릿을 수정하려면 어떻게해야합니까?
당신은 fo를 생성하는 : 테이블/fo : inline by'xsl : for-each select = "tr [1]/th | tr [1]/td"'명령. 이 구조는 XSL-FO에서는 허용되지 않습니다. fo : table의 직접적인 자식은'(table-column *, table-header?, table-footer?, table-body +)'이어야한다. – tmakita