XSLT函数——system-property()

      system-property()函数用于返回某个系统属性的值。参数string指定系统属性的名字。

      语法:system-property(string)

      参数:string字符串,必需

      返回值:XPath表达式

示例

xml:

<?xml version="1.0" encoding="UTF-8"?>
<root/>

xslt:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="text" version="1.0" encoding="gb2312" indent="yes"/>    
    <xsl:template match="/">
        <xsl:text>version:</xsl:text>    
        <xsl:value-of select="system-property('xsl:version')"/>
        <xsl:text>&#x000A;vendor:</xsl:text>    
        <xsl:value-of select="processing-instruction('xsl:vendor')"/>
        <xsl:text>&#x000A;vendor-url:</xsl:text>    
        <xsl:value-of select="processing-instruction('xsl:vendor-url')"/>
    </xsl:template>
</xsl:stylesheet>
结果:
version:1
vendor:
vendor-url:
posted @ 2010-01-17 04:46  Asharp  阅读(402)  评论(0编辑  收藏  举报