XSLT(12) Generating Output

Element

The easiest and most common way to generate element is literal result element. An element that is declared directly in the xslt file without any prefix. But sometimes you want to put it in a <xsl:element> node. Sometimes you want to use attribute value template within the name of the element. You can put curly brackets {} in the name attribute of xsl:element node.
So xsl:element is rarely used unless you are translating to xml document.

The name attribute is required

Namespace

Namespace can be declared in the xsl:stylesheet element.  Namespace declared in the xsl:stylesheet will be appear in the result document. 
exclude-result-prefixes attribute can be used to exclude the namespace declaration in the stylesheet.

The default element in xsl:stylesheet is also the default element of the output file.
 

You can include a namespace in the xsl:element name attribute
So math prefix is used to decorate the <matrix> element
<xsl:element name="math:matrix">
...
</xsl:element>


<xsl:namespace>
has a name attribute to hold the prefix and a select attribute or content to hold the namespace

Attribute

<xsl:attribute>use select attribute to select the value for the attribute. 
use content to hold the text

<xsl:attribute-set>defines a set of attributes

<xsl:attribute-set>
<xsl:attribute name="attr1">value1</xsl:attribute>
<xsl:attribute name="attr2">value2</xsl:attribute>
</xsl:attribute-set>

To use attribute sets, specify a use-attribute-sets attribute on <xsl:element>, <xsl:copy>, or <xsl:attribute-set> elements.
Attribute sets can also be used by specifying an xsl:use-attribute-sets attribute on a literal result element.

Document

xsl:result-document> creates a result document with href attribute as its file name
format attribute is optional






  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值