课程表

XSLT 教程

XSLT 高级

XSLT 参考手册

XSLFO 教程

XPath 教程

工具箱
速查手册

XSLFO 与 XSLT

当前位置:免费教程 » XML相关 » XSL

XSL-FO 与 XSLT 可彼此互助。

还记得这个例子吗?

  1. <fo:block
  2. font-size="14pt" font-family="verdana" color="red"
  3. space-before="5mm" space-after="5mm">
  4. W3xue
  5. </fo:block>
  6.  
  7. <fo:block
  8. text-indent="5mm"
  9. font-family="verdana" font-size="12pt"
  10. space-before="5mm" space-after="5mm">
  11. At W3xue you will find all the Web-building tutorials you
  12. need, from basic HTML and HTML5 to advanced XML, PHP,ASP.net, Python and
  13. Multimedia.
  14. </fo:block>

结果:

此例来自有关 XSL-FO 块区域的那一节。

来自 XSLT 的帮助

从文档移除 XSL-FO 信息:

  1. <header>
  2. W3xue
  3. </header>
  4.  
  5. <paragraph>
  6. At W3xue you will find all the Web-building tutorials you
  7. need, from basic HTML and HTML5 to advanced XML, PHP,ASP.net, Python
  8. and Multimedia.
  9. </paragraph>

添加 XSLT 转换:

  1. <xsl:template match="header">
  2. <fo:block
  3. font-size="14pt" font-family="verdana" color="red"
  4. space-before="5mm" space-after="5mm">
  5. <xsl:apply-templates/>
  6. </fo:block>
  7. </xsl:template>
  8.  
  9. <xsl:template match="paragraph">
  10. <fo:block
  11. text-indent="5mm"
  12. font-family="verdana" font-size="12pt"
  13. space-before="5mm" space-after="5mm">
  14. <xsl:apply-templates/>
  15. </fo:block>
  16. </xsl:template>

产生的结果是相同的:

转载本站内容时,请务必注明来自W3xue,违者必究。
 友情链接:直通硅谷  点职佳  北美留学生论坛

本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728

W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。
关于我们  |  意见建议  |  捐助我们  |  报错有奖  |  广告合作、友情链接(目前9元/月)请联系QQ:27243702 沸活量
皖ICP备17017327号-2 皖公网安备34020702000426号