我遇到与文字对齐有关的问题(垂直) 如何对齐文字? 请在xsl:fo
中查看我的布局输出
1 [(aa)] hello
必需的输出
1 [(aa)]你好
_layout
<fo:page-sequence-master master-name="statutesreport">
<xsl:text>
</xsl:text>
<fo:repeatable-page-master-alternatives>
<xsl:text>
</xsl:text>
<fo:conditional-page-master-reference page-position="first" odd-or-even="odd" master-reference="statues.first"/>
<xsl:text>
</xsl:text>
<fo:conditional-page-master-reference page-position="any" odd-or-even="odd" master-reference="statues.odd"/>
<xsl:text>
</xsl:text>
<fo:conditional-page-master-reference page-position="any" odd-or-even="even" master-reference="statues.even"/>
<xsl:text>
</xsl:text>
</fo:repeatable-page-master-alternatives>
<xsl:text>
</xsl:text>
</fo:page-sequence-master>
<xsl:text>
</xsl:text>
<fo:simple-page-master master-name="statues.first" page-height="297mm" page-width="210mm">
<xsl:text>
</xsl:text>
<fo:region-body margin-left="44.5mm" margin-right="44.5mm" margin-top="50.75mm" margin-bottom="50.75mm"/>
<xsl:text>
</xsl:text>
<fo:region-before extent="50.75mm" region-name="xsl-region-before-first-any"/>
<xsl:text>
</xsl:text>
<fo:region-after extent="50.75mm" region-name="xsl-region-after-first-any"/>
<xsl:text>
</xsl:text>
<fo:region-start extent="44.5mm"/>
<xsl:text>
</xsl:text>
<fo:region-end extent="44.5mm"/>
<xsl:text>
</xsl:text>
</fo:simple-page-master>
<xsl:text>
</xsl:text>
<fo:simple-page-master master-name="statues.even" page-height="297mm" page-width="210mm">
<xsl:text>
</xsl:text>
<xsl:choose>
<xsl:when test="//@longfolio='yes'">
<fo:region-body margin-left="44.5mm" margin-right="44.5mm" margin-top="53mm" margin-bottom="49mm"/>
</xsl:when>
<xsl:otherwise>
<fo:region-body margin-left="44.5mm" margin-right="44.5mm" margin-top="49mm" margin-bottom="49mm"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>
</xsl:text>
<fo:region-before extent="49mm" display-align="before" region-name="xsl-region-before-even"/>
<xsl:text>
</xsl:text>
<fo:region-after extent="49mm" display-align="center" region-name="xsl-region-after-even"/>
<xsl:text>
</xsl:text>
<fo:region-start extent="44.5mm" display-align="before"/>
<xsl:text>
</xsl:text>
<fo:region-end extent="44.5mm" display-align="before"/>
<xsl:text>
</xsl:text>
</fo:simple-page-master>
<xsl:text>
</xsl:text>
<fo:simple-page-master master-name="statues.odd" page-height="297mm" page-width="210mm">
<xsl:text>
</xsl:text>
<xsl:choose>
<xsl:when test="//@longfolio='yes'">
<fo:region-body margin-left="44.5mm" margin-right="44.5mm" margin-top="53mm" margin-bottom="49mm"/>
</xsl:when>
<xsl:otherwise>
<fo:region-body margin-left="44.5mm" margin-right="44.5mm" margin-top="49mm" margin-bottom="49mm"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>
</xsl:text>
<fo:region-before extent="49mm" display-align="before" region-name="xsl-region-before-odd"/>
<xsl:text>
</xsl:text>
<fo:region-after extent="49mm" display-align="center" region-name="xsl-region-after-odd"/>
<xsl:text>
</xsl:text>
<fo:region-start extent="44.5mm" display-align="before"/>
<xsl:text>
</xsl:text>
<fo:region-end extent="44.5mm" display-align="before"/>
<xsl:text>
</xsl:text>
</fo:simple-page-master>
<xsl:text>
</xsl:text>
</fo:layout-master-set>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="BodyText">
<xsl:text>
</xsl:text>
<fo:page-sequence role="CaseReport" master-reference="statutesreport">
<xsl:text>
</xsl:text>
<fo:static-content flow-name="xsl-region-after-first-any">
<xsl:call-template name="footer"/>
</fo:static-content>
<xsl:text>
</xsl:text>
<fo:static-content flow-name="xsl-region-before-odd">
<xsl:call-template name="oddheader"/>
</fo:static-content>
<xsl:text>
</xsl:text>
<fo:static-content flow-name="xsl-region-before-even">
<xsl:call-template name="evenheader"/>
</fo:static-content>
<xsl:text>
</xsl:text>
<xsl:text>
</xsl:text>
<xsl:text>
</xsl:text>
<fo:static-content flow-name="xsl-footnote-separator">
<fo:block font-size="4pt" margin-top="1pt" margin-bottom="5pt">
<fo:leader leader-pattern="rule" leader-length="56mm" rule-style="solid" rule-thickness="0.5pt"/>
</fo:block>
</fo:static-content>
<xsl:text>
</xsl:text>
<xsl:text>
</xsl:text>
<fo:flow flow-name="xsl-region-body" font-size="10pt" font-family="Times">
<xsl:text>
</xsl:text>
<fo:block>
<xsl:apply-templates/>
</fo:block>
<xsl:text>
</xsl:text>
</fo:flow>
<xsl:text>
</xsl:text>
</fo:page-sequence>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template name="footer">
<xsl:text>
</xsl:text>
<fo:block text-align="center" font-family="Times" font-size="10pt">
<xsl:text>[ </xsl:text><xsl:value-of select="//startpage"/><xsl:text> ]</xsl:text>
</fo:block>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template name="oddheader">
<xsl:text>
</xsl:text>
<fo:block margin-top="42.5mm">
<xsl:text>
</xsl:text>
<fo:table table-layout="fixed" width="121mm">
<xsl:text>
</xsl:text>
<fo:table-column column-width="20mm"/>
<xsl:text>
</xsl:text>
<fo:table-column column-width="81mm"/>
<xsl:text>
</xsl:text>
<fo:table-column column-width="20mm"/>
<xsl:text>
</xsl:text>
<fo:table-body>
<xsl:text>
</xsl:text>
<fo:table-row>
<xsl:text>
</xsl:text>
<fo:table-cell margin-left="0mm">
<fo:block text-align="left" font-size="10pt" font-family="Times">
<fo:retrieve-marker retrieve-class-name="suni" retrieve-position="last-ending-within-page" retrieve-boundary="document"/>
</fo:block>
</fo:table-cell>
<fo:table-cell margin-left="0mm" vertical-align="middle">
<fo:block text-align="center" font-size="8pt" font-family="Times">
<xsl:value-of select="//stname"/><xsl:text> </xsl:text>
<fo:inline font-size="10pt" font-family="Times">
<xsl:value-of select="//styear"/>
</fo:inline>
</fo:block>
</fo:table-cell>
<xsl:text>
</xsl:text>
<fo:table-cell vertical-align="top">
<fo:block text-align="right" font-size="10pt" font-family="Times">
<fo:page-number/>
</fo:block>
</fo:table-cell>
<xsl:text>
</xsl:text>
</fo:table-row>
<xsl:text>
</xsl:text>
</fo:table-body>
<xsl:text>
</xsl:text>
</fo:table>
<xsl:text>
</xsl:text>
</fo:block>
</xsl:template>
<xsl:template name="evenheader">
<xsl:text>
</xsl:text>
<fo:block margin-top="42.5mm">
<xsl:text>
</xsl:text>
<fo:table table-layout="fixed" width="121mm">
<xsl:text>
</xsl:text>
<fo:table-column column-width="20mm"/>
<xsl:text>
</xsl:text>
<fo:table-column column-width="81mm"/>
<xsl:text>
</xsl:text>
<fo:table-column column-width="20mm"/>
<xsl:text>
</xsl:text>
<fo:table-body>
<xsl:text>
</xsl:text>
<fo:table-row>
<xsl:text>
</xsl:text>
<fo:table-cell vertical-align="top">
<fo:block text-align="left" font-size="10pt" font-family="Times">
<fo:page-number/>
</fo:block>
</fo:table-cell>
<xsl:text>
</xsl:text>
<fo:table-cell vertical-align="middle">
<fo:block text-align="center" font-size="8pt" font-family="Times">
<xsl:value-of select="//stname"/><xsl:text> </xsl:text>
<fo:inline font-size="10pt" font-family="Times">
<xsl:value-of select="//styear"/>
</fo:inline>
</fo:block>
</fo:table-cell>
<xsl:text>
</xsl:text>
<fo:table-cell vertical-align="top">
<fo:block text-align="right" font-size="10pt" font-family="Times">
<fo:retrieve-marker retrieve-class-name="suni" retrieve-position="first-starting-within-page" retrieve-boundary="document"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
<xsl:text>
</xsl:text>
</fo:table-body>
<xsl:text>
</xsl:text>
</fo:table>
<xsl:text>
</xsl:text>
</fo:block>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="para">
<fo:block>
<xsl:call-template name="para"/>
<xsl:if test="@align">
<xsl:attribute name="text-align"><xsl:value-of select="@align"/></xsl:attribute>
</xsl:if>
<xsl:if test="@fontsize">
<xsl:attribute name="font-size"><xsl:value-of select="@fontsize"/></xsl:attribute>
</xsl:if>
<xsl:if test="@hspace">
<xsl:attribute name="letter-spacing"><xsl:value-of select="@hspace"/></xsl:attribute>
</xsl:if>
<xsl:if test="@font">
<xsl:attribute name="font-family"><xsl:value-of select="@font"/></xsl:attribute>
</xsl:if>
<xsl:if test="stnum">
<fo:inline>
<fo:marker marker-class-name="suni">
<xsl:value-of select="//foliotype"/>
<xsl:text>. </xsl:text>
<xsl:value-of select="replace(stnum, '([^<>]+).', '$1')"/>]</fo:marker>
</fo:inline>
</xsl:if>
<xsl:apply-templates/>
</fo:block>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="chapterheading">
<fo:block>
<xsl:call-template name="chapterheading"/>
<xsl:apply-templates/>
</fo:block>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="chapter">
<fo:block>
<xsl:call-template name="chapter"/>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<xsl:template match="para_left">
<fo:block>
<xsl:call-template name="para_left"/>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<xsl:template match="hrule">
<fo:block margin-left="0pt" margin-bottom="10pt">
<fo:leader leader-pattern="rule" leader-length="121mm" rule-style="solid" rule-thickness=".5pt"/>
</fo:block>
</xsl:template>
<xsl:template match="stnum">
<fo:inline font-weight="bold">
<xsl:apply-templates/>
</fo:inline>
<xsl:text> </xsl:text>
</xsl:template>
<xsl:template match="bold">
<fo:inline font-weight="bold">
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
<xsl:template match="italic">
<fo:inline font-style="italic">
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
<xsl:template match="underline">
<fo:inline text-decoration="underline">
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
<xsl:template match="smallcaps">
<xsl:apply-templates mode="small"/>
</xsl:template>
<xsl:template match="citref">
<fo:inline>
<xsl:value-of select="."/>
</fo:inline>
</xsl:template>
<xsl:template match="citref">
<fo:inline>
<xsl:value-of select="."/>
</fo:inline>
</xsl:template>
<xsl:template match="scccriref|scclnsref|scccivilref|scctaxref|sccartref|sccref">
<fo:inline>
<xsl:value-of select="."/>
</fo:inline>
</xsl:template>
<xsl:template match="linebreak">
<fo:block/>
</xsl:template>
<xsl:template match="pagebreak">
<fo:block page-break-before="always"/>
</xsl:template>
<xsl:template match="ActObject"/>
</xsl:stylesheet>
_PDF
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mf="http://example.com/mf" exclude-result-prefixes="mf xs" version="2.0">
<xsl:include href="statutes_layout.xsl"/>
<xsl:include href="statutes_style.xsl"/>
<xsl:include href="replace.xsl"/>
<xsl:include href="footnote.xsl"/>
<xsl:character-map name="dashes">
<xsl:output-character character="'" string="’"/>
</xsl:character-map>
<xsl:template match="/">
<xsl:call-template name="user-visible-root-template"/>
</xsl:template>
<xsl:template name="user-visible-root-template">
<xsl:text>
</xsl:text>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:text>
</xsl:text>
<xsl:call-template name="emit-layout-master-set"/>
<xsl:text>
</xsl:text>
<xsl:apply-templates/>
</fo:root>
</xsl:template>
<xsl:key name="smallc" match="smallc" use="@input"/>
<xsl:function name="mf:replace-smallcs" as="xs:string">
<xsl:param name="smallcs" as="element(smallc)*"/>
<xsl:param name="text" as="xs:string"/>
<xsl:choose>
<xsl:when test="not($smallcs)">
<xsl:sequence select="$text"/>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="mf:replace-smallcs($smallcs[position() gt 1], replace($text, $smallcs[1]/@input, $smallcs[1]/@output))"/>
</xsl:otherwise>
</xsl:choose>
</xsl:function>
<xsl:template match="text()" mode="small">
<xsl:value-of select="mf:replace-smallcs($smallcs/smallcs/smallc, .)" disable-output-escaping="yes"/>
</xsl:template>
</xsl:stylesheet>
脚注
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="2.0">
<xsl:template match="footnoteref">
<xsl:variable name="fnoteid" select="@refid"/>
<fo:footnote>
<fo:inline font-size="70%" baseline-shift="super">
<xsl:apply-templates/>
</fo:inline>
<fo:footnote-body>
<fo:list-block provisional-label-separation="2.5mm" provisional-distance-between-starts="10mm" start-indent="0cm">
<fo:list-item>
<fo:list-item-label end-indent="label-end()">
<fo:block text-align="right" text-indent="0pt" margin-left="0pt" font-size="8.5">
<xsl:value-of select="//footnote[@id=$fnoteid]/footnum"/>
<xsl:choose>
<xsl:when test="$fnoteid = 1 to 9000"><xsl:text>.</xsl:text></xsl:when>
</xsl:choose>
</fo:block>
</fo:list-item-label>
<fo:list-item-body start-indent="body-start()">
<fo:block text-align="justify" text-indent="0pt" margin-left="0pt" font-size="8.5">
<xsl:apply-templates select="//footnote[@id=$fnoteid]"/>
</fo:block>
</fo:list-item-body>
</fo:list-item>
</fo:list-block>
</fo:footnote-body>
</fo:footnote>
</xsl:template>
_Listing
<xsl:template match="list">
<xsl:choose>
<xsl:when test="parent::para">
<fo:list-block provisional-label-separation="2.5mm" provisional-distance-between-starts="10mm">
<xsl:apply-templates/>
</fo:list-block>
</xsl:when>
<xsl:when test="parent::listbody/parent::listitem/parent::list/parent::para">
<fo:list-block provisional-label-separation="2.5mm" provisional-distance-between-starts="10mm">
<xsl:apply-templates/>
</fo:list-block>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="listitem">
<xsl:choose>
<xsl:when test="parent::list/parent::para">
<fo:list-item margin-left="0pt" text-indent="0pt">
<xsl:apply-templates/>
</fo:list-item>
</xsl:when>
<xsl:when test="parent::list/parent::listbody/parent::listitem/parent::list/parent::para">
<fo:list-item text-indent="0pt" font-size="normal">
<xsl:apply-templates/>
</fo:list-item>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="listlable">
<fo:list-item-label end-indent="label-end()" font-size="100%" baseline-shift="30%" linefeed-treatment="preserve">
<fo:block text-align="right"><xsl:apply-templates/></fo:block>
</fo:list-item-label>
</xsl:template>
<xsl:template match="listbody">
<fo:list-item-body start-indent="body-start()">
<fo:block text-align="justify"><xsl:apply-templates/></fo:block>
</fo:list-item-body>
</xsl:template>
<xsl:template match="endnote"/>
<xsl:template match="footnum"/>
</xsl:stylesheet>
_style
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="2.0">
<xsl:template name="para">
<xsl:attribute name="text-indent">18pt</xsl:attribute>
<xsl:attribute name="text-align">justify</xsl:attribute>
</xsl:template>
<xsl:template name="para_left">
<xsl:attribute name="text-align">justify</xsl:attribute>
</xsl:template>
<xsl:template name="chapter">
<xsl:attribute name="text-align">center</xsl:attribute>
<xsl:attribute name="margin-top">6pt</xsl:attribute>
<xsl:attribute name="margin-bottom">2pt</xsl:attribute>
</xsl:template>
<xsl:template name="chapterheading">
<xsl:attribute name="text-align">center</xsl:attribute>
<xsl:attribute name="margin-top">2pt</xsl:attribute>
<xsl:attribute name="margin-bottom">2pt</xsl:attribute>
</xsl:template>
<xsl:template name="footnoteref">
<xsl:attribute name="baseline-shift">2pt</xsl:attribute>
<xsl:attribute name="font-size">8pt</xsl:attribute>
</xsl:template>
</xsl:stylesheet>