2013-04-01 59 views
0

是否可以從xsl文檔本身讀取xsl屬性?我需要的是這樣的:xslt:從xsl本身獲取屬性

mystyle.xsl中

<?xml version="1.0" encoding="iso-8859-1"?> 
<xsl:stylesheet 
    version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:html="http://www.w3.org/1999/xhtml" 
    xmlns="http://www.w3.org/1999/xhtml" 
    id="I'm a special stylesheet"> 

    ... 
    <!-- Output should be: "stylesheet id: I'm a special stylesheet" --> 
    <xsl:text>stylesheet id:</xsl:text><xsl:value-of select="/@id"/> 
    ... 

</xsl:stylesheet> 

這可能嗎?

回答

1

是的,您至少可以使用<xsl:value-of select="document('')/xsl:stylesheet/@id"/>,至少只要樣式表已從URI加載即可。

+0

工作。謝謝 :) – sbo