综合

img nethermit

XSLT Programmer's Reference 读书笔记

发表于2004/11/2 14:00:00  1310人阅读

看的是英文电子版,读到一些好句子,摘录一下,大家看着玩玩

  • There is no explicit provision for XHTML output, but since XHTML is pure XML, it can be written using the XML method in the same way as any other XML document type.
  • The difference between <xsl:include> and <xsl:import> is that conflicting definitions are resolved differently:

    • <xsl:include> effectively does a textual inclusion of the referenced stylesheet module, minus its containing <xsl:stylesheet> element, at the point where the <xsl:include> element is written. The included module is treated exactly as if its top-level elements, with their contents, appeared in the parent module in place of the <xsl:include> element itself.

    • <xsl:import> also incorporates the top-level elements from the referenced stylesheet module, but in this case the definitions in the imported module have lower import precedence than the definitions in the parent module. If there are conflicting definitions, the one with higher import precedence will generally win. The detailed rules actually depend on the type of definition, and are given in the specification of <xsl:import> on page 226, in Chapter 4. Importing a module is thus rather like defining a subclass, in that the parent module can use some definitions unchanged from the imported module, and override others with definitions of its own.

  • It is an error for a stylesheet module to import or include itself, directly or indirectly, because doing so would define an infinite loop.
  • It isn't an error, however, for a stylesheet module to be included or imported at more than one place in the stylesheet program.
  • People often ask for some kind of facility to load stylesheet modules dynamically, based on a decision made while the transformation is running. The simple answer is that you can't do this.
  • The typical way of using this is to have one stylesheet containing common template rules, followed by more specific stylesheet modules distinguished using the title or media pseudo-attributes. But other products, notably Microsoft's MSXML3, simply use the first stylesheet and ignore the others.
  • Bitten by years of experience with proprietary vendor extensions to HTML, the W3C committee responsible for XSLT took great care to allow vendor extensions in a tightly controlled way.
  • What this means in practice is that if you want to be specific about whitespace characters, write them as character references; if you just want to use them as separators and padding, use the whitespace characters directly.
  • Unlike variables in many programming languages, XSLT variables cannot be updated. Once they are given an initial value, they retain that value until they go out of scope. This feature has a profound effect on the programming style used when a stylesheet needs to do calculations. The subject of programming without assignment statements is discussed in detail in Chapter 9.
阅读全文
0 0

相关文章推荐

img
取 消
img