-- 作者:cater
-- 发布时间:5/8/2004 9:46:00 PM
-- [求助]关于XSL中参数的问题,哪位老大可以接受挑战
哪位高手帮忙看看,下边这段传参的代码哪儿有问题,如果想在页面的最下边显示,应放在 整个程序的哪个位置: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 传参的代码: <xsl:template match="/"> <table width="40%" align="center" border="2" bgcolor="F6B94E"> <tr> <xsl:variable name="Test">中国最佳女演员评比结果:</xsl:variable> <xsl:value-of select="$Test"/> <p> 观众投票最多者: </p> <xsl:call-template name="最有气质女演员:"/> 评比结果是: <xsl:call-template name="最有气质女演员:"> <xsl:with-param name="Star">刘嘉玲</xsl:with-param> </xsl:call-template> <xsl:output method="xml"/> <xsl:template name="最有气质女演员" match="best"> <xsl:param name="Star">李嘉欣 </xsl:param> <p> 最有气质女演员: <xsl:value-of select="$Star"/> </p> </xsl:template> </tr> </table> </xsl:template > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`` 整体程序(XSL): <?xml version="1.0" encoding="GB2312"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <xsl:template> <xsl:apply-templates/> </xsl:template> <xsl:template match="china"> <table width="80%" align="center" border="3"> <span style="font-size:30pt; color:EA0437; font-weight:bolder; display:block; text-align:center; background-image: url(im2.gif); "><p></p><br>新 片 预 告</br><p></p></span></table> <table width="80%" align="center" border="3"> <span style="font-size:14pt; color:F8963E; font-weight:bolder; display:block; text-align:left; background-image: url(db.gif); background-position-vertical:50%; ">中国影片</span></table> <table width="80%" align="center" border="1" bgcolor="CFF328" > <xsl:for-each select="film"> <tr><td colspan="1" width="20%">片 名</td> <td colspan="3"><xsl:apply-templates select="name" /></td> </tr><tr> <td>导 演</td> <td width="20%"><xsl:apply-templates select="director" /></td> <td width="20%">主 演</td> <td><xsl:apply-templates select="stars" /></td> </tr><tr> <td>内容简介</td> <td colspan="3"> <xsl:apply-templates select="review" /> </td></tr> </xsl:for-each> </table> </xsl:template> <!--定义样版通过元素内容筛选 --> <xsl:template match="name[.='刮痧']"> <b><xsl:value-of /></b> </xsl:template> <xsl:template match="name[.='海上花']"> <b><xsl:value-of /></b> </xsl:template> <xsl:template match="name[.='幸福时光']"> <b><xsl:value-of /></b> </xsl:template> <!--xsl:if 进行筛选 --> <xsl:template match="director"> <xsl:if match=".[.='郑晓龙']"> <i><xsl:value-of /></i> </xsl:if> <xsl:if match=".[.='侯孝贤']"> <i><xsl:value-of /></i> </xsl:if> <xsl:if match=".[.='张艺谋']"> <i> <xsl:value-of /> </i> </xsl:if> </xsl:template> <xsl:template match="foreign"> <table width="80%" align="center" border="3"> <span style="font-size:14pt; color:F8963E; font-weight:bolder; display:block; text-align:left; background-image: url(db1.gif); background-position-vertical:50%; ">外国影片</span></table> <table width="80%" align="center" border="1" bgcolor="86A8F3"> <xsl:for-each select="film"> <tr><td colspan="1" width="20%">片 名</td> <td colspan="3"><xsl:apply-templates select="name" /></td> </tr><tr> <td>导 演</td> <td width="20%"><xsl:apply-templates select="director" /></td> <td width="20%">主 演</td> <td><xsl:apply-templates select="stars" /></td> </tr><tr> <td>内容简介</td> <td colspan="3"> <xsl:apply-templates select="review" /> </td></tr> </xsl:for-each> </table> </xsl:template> <!--定义样版通过元素内容筛选 --> <xsl:template match="name[.='情书']"> <b><xsl:value-of /></b> </xsl:template> <xsl:template match="name[.='勇敢的心']"> <b><xsl:value-of /></b> </xsl:template> <xsl:template match="name[.='辛德勒的名单']"> <b><xsl:value-of /></b> </xsl:template> <!--xsl:if 进行筛选 --> <xsl:template match="director[.='岩井俊二']"> <i><xsl:value-of /></i> </xsl:template> <xsl:template match="director[.='梅尔.吉布森']"> <i><xsl:value-of /></i> </xsl:template> <xsl:template match="director[.='斯皮尔博格']"> <i><xsl:value-of /></i> </xsl:template> <xsl:template match="stars"> <xsl:value-of /> </xsl:template> <!--利用xsl:choose结合xsl:when xsl:otherwise进行筛选--> <xsl:template match="review"> <xsl:choose> <!--利用xsl:when通过属性值进行筛选--> <xsl:when test=".[@num='1']"> <xsl:value-of /> </xsl:when> <xsl:when test=".[@num='2']"> <xsl:value-of /> </xsl:when> <!--利用xsl:otherwise处理其他的元素--> <xsl:otherwise> <xsl:value-of /> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet> 我的QQ是42319293,邮箱是squellct1@163.com 若有结果请与我联系 谢谢
|