我的代碼如下所示,它給出了樣式表編譯錯誤。XSL:選擇查詢
<xsl:template match="form">
<xsl:copy>
<xsl:for-each select="@*">
<xsl:variable name="param" select="name(.)" />
<xsl:choose>
<xsl:when test="$param = 'name'">
<xsl:attribute name="name"><xsl:value-of
select="@name" /></xsl:attribute>
</xsl:when>
<xsl:when test="$param = 'action'">
<xsl:attribute name="action"><xsl:value-of
select="java:com.hp.cpp.proxy.util.URLUtils.rewriteAction($response, $baseurl, @action, $scope)" /></xsl:attribute>
</xsl:when>
<xsl:when test="$param = 'method'">
<xsl:attribute name="method">POST</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="$param"><xsl:value-of
select="." /></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<input type="hidden" name="httpmethod">
<xsl:attribute name="value"> <xsl:value-of
select="@method" /></xsl:attribute>
</input>
<xsl:apply-templates select="node()|@*" />
</xsl:copy>
</xsl:template>
我想重新寫HTML的FORM標籤與相當複雜的要求。希望你能通過代碼捕捉來識別。我正在嘗試重新編寫標籤的一些屬性,並試圖保留其餘部分。這是正確的方式嗎?任何其他方式來做到這一點?任何建議。
在此先感謝。
-Rikin
你說你得到一個編譯錯誤,但沒有哪一個。你也可以將你的問題標記爲1.0和2.0,這是什麼?你能用一個最小的完整例子(包括xsl:stylesheet和聲明的命名空間)更新你的問題嗎?我的猜測是擴展方法'rewriteAction'沒有聲明或不存在。 – Abel