Transforming XML with XSLT - XSLT: Extensible Stylesheet Language Transformations 编辑
An Overview
The separation of content and presentation is a key design feature of XML. The structure of an XML document is designed to reflect and clarify important relationships among the individual aspects of the content itself, unhindered by a need to provide any indication about how this data should eventually be presented. This intelligent structuring is particularly important as more and more data transfers are automated and take place between highly heterogeneous machines linked by a network.
Yet eventually much of the content stored in XML documents will need to be presented to human readers. Because a browser provides a familiar and highly flexible interface, it is an ideal mechanism for delivering such presentation versions of XML content. Built from the ground up utilizing a wide variety of XML technologies, Firefox incorporates within itself all of the mechanisms needed to process both original XML documents and the specialized stylesheets used to style and lay them out for HTML display, reducing server load with client-side processing.
At present, Gecko (the layout engine behind Firefox) supports two forms of XML stylesheets. For basic control of appearance — fonts, colors, position, and so forth — Gecko uses CSS. CSS1 and CSS2 are well supported and support for the emerging CSS3 standard is under development. For further information about CSS, see Eric Meyer's CSS pages.
Our focus here is on the second type of stylesheet that Gecko supports: the XSLT stylesheet. XSLT stands for eXtensible Stylesheet Language/Transform and the name is apt. XSLT allows a stylesheet author to transform a primary XML document in two significant ways: manipulating and sorting the content, including a wholesale reordering of it if so desired, and transforming the content into a different format (and in the case of Firefox, the focus is on converting it on the fly into HTML which can then be displayed by the browser).
XSLT/XPath reference
Elements
- xsl:apply-imports (supported)
- xsl:apply-templates (supported)
- xsl:attribute (supported)
- xsl:attribute-set (supported)
- xsl:call-template (supported)
- xsl:choose (supported)
- xsl:comment (supported)
- xsl:copy (supported)
- xsl:copy-of (supported)
- xsl:decimal-format (supported)
- xsl:element (supported)
- xsl:fallback (not supported)
- xsl:for-each (supported)
- xsl:if (supported)
- xsl:import (mostly supported)
- xsl:include (supported)
- xsl:key (supported)
- xsl:message (supported)
- xsl:namespace-alias (not supported)
- xsl:number (partially supported)
- xsl:otherwise (supported)
- xsl:output (partially supported)
- xsl:param (supported)
- xsl:preserve-space (supported)
- xsl:processing-instruction
- xsl:sort (supported)
- xsl:strip-space (supported)
- xsl:stylesheet (partially supported)
- xsl:template (supported)
- xsl:text (partially supported)
- xsl:transform (supported)
- xsl:value-of (partially supported)
- xsl:variable (supported)
- xsl:when (supported)
- xsl:with-param (supported)
Axes
- ancestor
- ancestor-or-self
- attribute
- child
- descendant
- descendant-or-self
- following
- following-sibling
- namespace (not supported)
- parent
- preceding
- preceding-sibling
- self
Functions
- boolean() (supported)
- ceiling() (supported)
- concat() (supported)
- contains() (supported)
- count() (supported)
- current() (supported)
- document() (supported)
- element-available() (supported)
- false() (supported)
- floor() (supported)
- format-number() (supported)
- function-available() (supported)
- generate-id() (supported)
- id() (partially supported)
- key() (supported)
- lang() (supported)
- last() (supported)
- local-name() (supported)
- name() (supported)
- namespace-uri() (supported)
- normalize-space() (supported)
- not() (supported)
- number() (supported)
- position() (supported)
- round() (supported)
- starts-with() (supported)
- string() (supported)
- string-length() (supported)
- substring() (supported)
- substring-after() (supported)
- substring-before() (supported)
- sum() (supported)
- system-property() (supported)
- translate() (supported)
- true() (supported)
- unparsed-entity-url() (not supported)
For Further Reading
Resources
Index
Original Document Information
- Copyright Information: Copyright © 2001-2003 Netscape. All rights reserved.
- Note: This reprinted article was originally part of the DevEdge site.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论