转至繁体中文版     | 网站首页 | 图文教程 | 资源下载 | 站长博客 | 图片素材 | 武汉seo | 武汉网站优化 | 
最新公告:     敏韬网|教学资源学习资料永久免费分享站!  [mintao  2008年9月2日]        
您现在的位置: 学习笔记 >> 图文教程 >> 站长学院 >> Web开发 >> 正文
XSL对象格式使用指南(三)         ★★★★

XSL对象格式使用指南(三)

作者:闵涛 文章来源:闵涛的学习笔记 点击数:588 更新时间:2009/4/23 11:18:02
    
  
  在前两篇中我们已经讨论了怎样处理封面页和内容页,现在我们准备把以下内容放入这西班牙评论手册里。
  
  
  标题和段落属性由<fo:block> 元素控制,粗体和带下划线的词语由<fo:inline>元素控制。现在开始描述第一个标题:
  <fo:block
  
  font-size="14pt" font-family="sans-serif"
  font-weight="bold" color="green"
  space-before="6pt" space-after="6pt">
  Introduction
  
  <fo:block>
  
  
  
  space-before属性和space-after属性是储存区域中属性设置值中的两种。这些属性和层叠样式表CSS相类似
  字体属性
  font-family,font-weight,font-style (斜体),font-size,font-stretch,font-variant
  背景属性
  background-color,background-image,background-repeat,background-attachment (卷动或固定)
  边界属性
  border-location-info:
  location可以为before,after,start,,end,,top,bottom,left或right
  info is 可以为字体,宽度或颜色
  填充属性
  padding-location:`
  location is 可以为before,after,,start,end,top,bottom,left或right
  空白属性
  margin-location:
  location可以为top,bottom,left或right
  文本排列属性
  text-align和text-align-last (用作文本最后一行); 函数可以为start,end,left,right或center
  缩排属性
  text-indent (第一行),start-indent,end-indent
  其他属性
  wrap-option (没有约束或有约束);widows和orphans (决定页面的顶部或左部有多少行)break-after和break-before;reference-orientation (将正文旋转90度)
  
  通过这些属性,我们可以明确定位一个复杂的段落。定位使用 “复合数据类型”的标点符号可以使页面的版面可以在不同的图像分辨率下自动适应:
  <fo:block
  
  text-indent="1em"
  font-family="sans-serif" font-size="12pt"
  space-before.minimum="2pt"
  space-before.maximum="6pt"
  space-before.optimum="4pt"
  space-after.minimum="2pt"
  space-after.maximum="6pt"
  space-after.optimum="4pt">
  This handbook covers the major topics in Spanish, but is by no means complete.
  
  <fo:block>
  
  
  
  如果你的文档有很多标题或段落时,你不需要将所有的文档逐一格式化。有XSLT ,我们能用XSLT把文档写入HTML 或转换成详细的XSL:FO 译本。以下是已经转换好的HTML :
  <h3>Introduction</h3>
  <p>
  This handbook covers the major topics in Spanish, but is by no means complete.
  </p>
  <h3>Accents</h3>
  <p>
  When we pronounce English words, one syllable is usually
  emphasized (<b>stressed</b>, in linguistic terms).
  The stressed syllable is underlined in the following words: com<u>pu</u>ter,<u>lan</u>guage, de<u>vel</u>opment, suc<u>ceeds</u>. Spanish words also have a stressed syllable, and there are rules for determining which syllable carries the emphasis.
  </p>
  
  
  下边是标题和段落的模板:
  <xsl:template match="h3">
  
  <fo:block font-size="14pt" font-family="sans-serif"
  font-weight="bold" color="green"
  space-before="6pt" space-after="6pt">
  <xsl:apply-templates/>
  </fo:block>
  
  </xsl:template>
  
  <xsl:template match="p">
  
  <fo:block
  text-indent="1em"
  font-family="sans-serif" font-size="12pt"
  space-before.minimum="2pt"
  space-before.maximum="6pt"
  space-before.optimum="4pt"
  space-after.minimum="2pt"
  space-after.maximum="6pt"
  space-after.optimum="4pt">
  <xsl:apply-templates/>
  </fo:block>
  
  </xsl:template>
  
  
  
  在这篇文章初始化时已经设定了模板并将<html>和 <body>标记了,我们在这时不用再重复,只需用浏览器检查一下。
  这是文档的树结构。用<b> 和 <u> 标记了最后一个子接点。它们在行列中的句柄为<fo:inline>元素。
  <xsl:template match="b">
  
  <fo:inline font-weight="bold">
  <xsl:apply-templates/>
  </fo:inline>
  
  </xsl:template>
  
  <xsl:template match="u">
  
  <fo:inline text-decoration="underline">
  <xsl:apply-templates/>
  </fo:inline>
  
  </xsl:template>
  
  <xsl:template match="i">
  
  <fo:inline font-style="italic">
  <xsl:apply-templates/>
  </fo:inline>
  
  </xsl:template>
  
  
  
  当我们通过XSLT 和FOP建立HTML文件将得到:
  
  
  
  
  
    


[Web开发]XSL对象格式使用指南(一)  [Web开发]XSL对象格式使用指南(四)
[Web开发]XSL对象格式使用指南(二)  
教程录入:mintao    责任编辑:mintao 
  • 上一篇教程:

  • 下一篇教程:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      注:本站部分文章源于互联网,版权归原作者所有!如有侵权,请原作者与本站联系,本站将立即删除! 本站文章除特别注明外均可转载,但需注明出处! [MinTao学以致用网]
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)

    同类栏目
    · Web开发  · 网页制作
    · 平面设计  · 网站运营
    · 网站推广  · 搜索优化
    · 建站心得  · 站长故事
    · 互联动态
    更多内容
    热门推荐 更多内容
  • 没有教程
  • 赞助链接
    更多内容
    闵涛博文 更多关于武汉SEO的内容
    500 - 内部服务器错误。

    500 - 内部服务器错误。

    您查找的资源存在问题,因而无法显示。

    | 设为首页 |加入收藏 | 联系站长 | 友情链接 | 版权申明 | 广告服务
    MinTao学以致用网

    Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved.
    闵涛 投放广告、内容合作请Q我! E_mail:admin@mintao.net(欢迎提供学习资源)

    站长:MinTao ICP备案号:鄂ICP备11006601号-18

    闵涛站盟:医药大全-武穴网A打造BCD……
    咸宁网络警察报警平台