8
xslt 파일을 만들면 xml이 xsl-fo로 변환됩니다. 물론XSLT를 사용하여 중첩 된 굵게/기울임 꼴 태그가있는 XSL-FO 만들기
<doc>
<par>
<point>
<text>some text</text>
</point>
</par>
</doc>
, 많은 단락과 포인트 문서에있다 :
XML은 같은 것입니다.
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" exclude-result-prefixes="fo">
<xsl:output method="xml" version="1.0" omit-xml-declaration="no" indent="yes"/>
<xsl:param name="versionParam" select="'1.0'"/>
<xsl:template match="doc">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="simpleA4" page-height="29.7cm" page-width="21cm" margin-top="2cm" margin-bottom="2cm" margin-left="2cm" margin-right="2cm">
<fo:region-body margin="2cm"/>
<fo:region-before margin="0.2cm" extent="1.5cm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="simpleA4">
<fo:static-content flow-name="xsl-region-before" margin-right="1cm">
<fo:block text-align="start" margin-top="0.2cm">
<fo:block text-align="end" margin-top="0.2cm">
Page <fo:page-number/> of <fo:page-number-citation ref-id="terminator"/>
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<xsl:apply-templates select="par/point"/>
<fo:block id="terminator"/>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="point">
<fo:block font-size="16pt" space-after="5mm">
<xsl:value-of select="tresc"/>
</fo:block>
</xsl:template>
</xsl:stylesheet>
해야 : 나는
<bold>bolded text</bold> and <italic>italic</italic>
지금
<fo:block><fo:inline font-weight="bold">bolded text</fo:inline> and <fo:inline font-style="italic">italic</fo:inline>
내가 가지고있는이 같은 매우 간단한 XSLT 문서는 제공해야 예를
를 들어, "텍스트"를 포맷하는 가능성을 추가하고 싶습니다 다른 템플릿 (굵게, 기울임 꼴)을 추가합니까? "텍스트"노드에서 어떻게 호출해야합니까? 나는 몇 가지 해결책을 발견 :<xsl:template match="//bold">
<fo:inline font-weight="bold">
<xsl:value-of select="current()"></xsl:value-of>
</fo:inline>
</xsl:template>
을하지만 나를 위해 작동하지 않았다. 출력 xsl-fo에는 fo : inline이 포함되지 않습니다.
은''중복 = "() 노드"를 선택한다. http://www.w3.org/TR/xslt#section-Applying-Template-Rules에서 : "'select' 속성이 없으면'xsl : apply-templates' 명령은 현재 노드, 텍스트 노드 포함. " –