FW:XSLT <xsl:namespace-alias>元素

Definition and Usage

The <xsl:namespace-alias> element is used to replace a namespace in the style sheet to a different namespace in the output.
<xsl:namespace-alias>元素的作用是:用样式表中的命名空间[namespace]替换输出结果中的命名空间。

Note: <xsl:namespace-alias> is a top-level element, and must be a child node of <xsl:stylesheet> or <xsl:transform>.
注意: <xsl:namespace-alias> 是一个最高级元素,并且,它必须是<xsl:stylesheet>或<xsl:transform>的一个子节点。


Syntax

<xsl:namespace-alias
stylesheet-prefix="prefix|#default"
result-prefix="prefix|"#default"/>

Attributes

属性
描述
stylesheet-prefix prefix
#default
Required. Specifies the namespace you wish to change
必要参数。指定你希望改变的命名空间
result-prefix prefix
#default
Required. Specifies the desired namespace for the output
必要参数。指定你希望输出的命名空间

 

Example 1

The wxsl prefix is converted to the xsl prefix in the output:
在输出的结果中将前缀名wxsl改为xsl:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wxsl="http://www.w3schools.com/w3style.xsl">
<xsl:namespace-alias stylesheet-prefix="wxsl" result-prefix="xsl"/>
<xsl:template match="/">

  <wxsl:stylesheet>
    <xsl:apply-templates/>
  </wxsl:stylesheet>
</xsl:template>
</xsl:stylesheet>
 
Example2

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://libfeed.com" xmlns:ns10="http://libfeed.com" xmlns:ns0="http://libfeed.com">
  <xsl:output indent="yes" method="xml"/>
  <xsl:namespace-alias stylesheet-prefix="ns0" result-prefix="ns10"/>
  <xsl:template match="/">
    <libfeed>
      <xsl:attribute name="version">1.0</xsl:attribute>
      <xsl:attribute name="provider">万方数据</xsl:attribute>
      <xsl:attribute name="datasource">标准</xsl:attribute>
      <xsl:attribute name="verifycode">1234</xsl:attribute>
      <xsl:apply-templates select="ns0:NewDataSet"/>
    </libfeed>

<?xml version="1.0" standalone="yes"?>
<ns0:NewDataSet xmlns:ns0="http://libfeed.com">
  <Table>
    <标准编号>GH/T 1015-1999</标准编号>
    <发布日期>1999-07-19</发布日期>
    <发布单位>CSIC-GH</发布单位>
    <标准状态>        </标准状态>
    <实施日期>1999-11-01</实施日期>
    <确认日期>        </确认日期>
    <国际标准分类号>        </国际标准分类号>
    <起草单位>        </起草单位>
    <截止日期>        </截止日期>
    <废止日期>        </废止日期>
    <标准类型>        </标准类型>
    <标准水平>        </标准水平>
    <标准名称>蜂蜜包装钢桶</标准名称>
    <正文语种>        </正文语种>
    <原文标准名称>        </原文标准名称>
    <英文名称>Chinese chestnut</英文名称>
    <开本页数>12P.;A4</开本页数>
    <是否有译文版本>        </是否有译文版本>
    <UDC分类号>        </UDC分类号>
    <附注>        </附注>
    <代替标准>        </代替标准>
    <替代标准>ZB B32002-1989</替代标准>
    <修改件>        </修改件>
    <引用标准>        </引用标准>
    <采用关系>        </采用关系>
    <补充件>        </补充件>
    <中国标准分类号>B47</中国标准分类号>
    <中文关键词>        </中文关键词>
    <英文关键词>        </英文关键词>
    <原文关键词>        </原文关键词>
    <主题标题>        </主题标题>
    <索取号>        </索取号>
    <馆藏标志>*</馆藏标志>
    <排序码>GH/T                01015   1999   000   000   000</排序码>
    <国别代码>中国</国别代码>
    <数据库标识>HBBASE</数据库标识>
    <中图分类号>S88;S89%S86</中图分类号>
  </Table>

</ns0:NewDataSet>

Result

<?xml version="1.0" encoding="UTF-8"?>
<ns10:libfeed xmlns:ns10="http://libfeed.com" version="1.0" provider="万方数据" datasource="标准" verifycode="1234">
    <ns10:publication category="标准">
        <ns10:content>
            <ns10:name title="发布单位">CSIC-GH</ns10:name>
        </ns10:content>
        <ns10:identifier type="标准发布单位">CSIC-GH</ns10:identifier>
        <ns10:CLC4/>
    </ns10:publication>

posted @ 2009-03-05 23:33  upzone  阅读(267)  评论(0编辑  收藏  举报