XSLT <xsl:with-param> ÔªËØ
¶¨ÒåºÍÓ÷¨
<xsl:with-param> ÔªËØ¶¨ÒåÁË´«µÝ¸øÄ£°åµÄ²ÎÊýµÄÖµ¡£
×¢ÊÍ£º<xsl:with-param> ÔªËØµÄ name ÊôÐÔµÄÖµ±ØÐëÓë <xsl:param> ÔªËØÖÐµÄ name ÏàÆ¥Å䣬·ñÔò½«ºöÂÔ <xsl:with-param> ÔªËØ£¬¡£
×¢ÊÍ£º<xsl:call-template> ºÍ <xsl:apply-templates> ÖоùÔÊÐíʹÓà <xsl:with-param> ÔªËØ¡£
Ìáʾ£ºÄú¿ÉÒÔͨ¹ý <xsl:with-param> ÔªËØµÄÄÚÈÝ»òͨ¹ý select ÊôÐÔ£¬À´Îª²ÎÊý¸³Öµ¡£
Óï·¨
<xsl:with-param name="name" select="expression"> <!-- Content:template --> </xsl:with-param>
ÊôÐÔ
ÊôÐÔ | Öµ | ÃèÊö |
---|---|---|
name | name | ±ØÐè¡£¹æ¶¨²ÎÊýµÄÃû³Æ¡£ |
select | expression | ¿ÉÑ¡¡£¶¨Òå²ÎÊýµÄÖµµÄ XPath ±í´ïʽ¡£ |
ʵÀý
Àý×Ó 1
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="xx">
<html>
<body>
<xsl:call-template name="show_title">
<xsl:with-param name="title" />
</xsl:call-template>
</body>
</html>
</xsl:variable>
<xsl:template name="show_title" match="/">
<xsl:param name="title" />
<xsl:for-each select="catalog/cd">
<p>Title: <xsl:value-of select="$title" /></p>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>