我花了2個小時來尋找在Internet上的工作有所幫助,但我沒有找到任何答案...的<xsl:-的值>不會在模板
我希望你能:)
所以,我的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" />
<xsl:param name="basename"/>
<xsl:param name="purpose"/>
<xsl:param name="xml_input_path"/>
<xsl:param name="self"/>
<xsl:template match="testspec">
<xsl:call-template name="call_commands"/>
</xsl:template>
<xsl:template name="call_commands">
<xsl:variable name="root" select="document($xml_input_path)/testspec"/>
<xsl:for-each select="$root//command">
<xsl:sort select="."/>
<xsl:variable name="current" select="."/>
<xsl:apply-templates select="document($self)/xsl:stylesheet/xsl:template[@name = $current/@label]"/>
</xsl:for-each>
</xsl:template>
<xsl:template name="TOTO_short">
<xsl:text>Fonction TOTO :</xsl:text>
<xsl:variable name="dda" select="'b'"/>
<xsl:copy-of select="$dda"/>
</xsl:template>
<xsl:template name="TATA_interrupt">
Fonction TATA :
<xsl:variable name="v1_name" select="'NaN'"/>
<xsl:value-of select="$v1_name" />
</xsl:template>
</xsl:stylesheet>
這裏是我的XML輸入:
<testspec>
<command label="TOTO_short"/>
<command label="TATA_interrupt"/>
<command label="TOTO_short"/>
<command label="TATA_interrupt"/>
</testspec>
我的問題是如下情況:TE mplates TOTO_short和TATA_short,我想定義2個變量並顯示它們的值...
但它不起作用!
你能幫我理解它來自哪裏嗎?
感謝很多提前:)
阿爾諾
你能否修改你的問題並告訴我們你期望的結果XML是什麼樣的? – ABach 2013-04-10 17:14:31