XSL-FO และ XSLT

XSL-FO และ XSLT สามารถช่วยเหลือกันได้

ยังจำได้ตัวอย่างนี้ไหม?

<fo:block
    font-size="14pt" font-family="verdana" color="red"
    space-before="5mm" space-after="5mm">
W3School
</fo:block>
<fo:block
    text-indent="5mm"
    font-family="verdana" font-size="12pt"
    space-before="5mm" space-after="5mm">
ที่ CodeW3C.com คุณจะหาได้ทั้งหมดตูตอรีแนลสร้างเว็บไซต์
ต้องการจาก HTML และ XHTML ภายในขั้นพื้นฐาน ไปจนถึง XML ภายในขั้นสูง และ Multimedia
และ WAP.
</fo:block>

ผลลัพธ์:}

ตัวอย่างนี้มาจากบทที่เกี่ยวกับโซนบล็อค XSL-FO

ช่วยเหลือจาก XSLT

ลบข้อมูล XSL-FO ออกจากเอกสาร:

<header>
W3School
</header>
<paragraph>
ที่ CodeW3C.com คุณจะหาได้ทั้งหมดตูตอรีแนลสร้างเว็บไซต์
ต้องการจาก HTML และ XHTML ภายในขั้นพื้นฐาน ไปจนถึง XML ภายในขั้นสูง และ Multimedia
และ WAP.
</paragraph>

เพิ่มการปรับแปลง XSLT:

<xsl:template match="header">
<fo:block
    font-size="14pt" font-family="verdana" color="red"
    space-before="5mm" space-after="5mm">
    <xsl:apply-templates/>
</fo:block>
</xsl:template>
<xsl:template match="paragraph">
<fo:block
    text-indent="5mm"
    font-family="verdana" font-size="12pt"
    space-before="5mm" space-after="5mm">
    <xsl:apply-templates/>
</fo:block>
</xsl:template>

ผลลัพธ์ที่ได้มาด้วยกันเหมือนกัน: