对于下面的模板,我怎么设置DIV的ID号?ID号根据FOR-EACH增加:

onekey 2003-10-09 09:48:27
<xsl:template match="DAV:response[DAV:propstat/DAV:prop/WP:HasFrame='1']">
<xsl:for-each select="DAV:propstat[0]/DAV:prop[0]">
<div style="background-color: #FFCC00; layer-background-color: #FFCC00;">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<xsl:if test="WP:IsVisible[.='0']"><xsl:attribute name="style">display:none</xsl:attribute></xsl:if>

<tr>
<td class="DashPartFrame">

<!-- Header Start -->
<table cellspacing="0" cellpadding="0" width="100%" border="0">
<tr>
<td class="DashPartTitle">
<xsl:choose>
<xsl:when test="WP:DetailLink[.!='']">
<a><xsl:attribute name="name">__WPDetailLink<xsl:value-of select="DDF:WebPartQualifier"/></xsl:attribute><xsl:attribute name="href"><xsl:value-of select="WP:DetailLink"/></xsl:attribute><nobr><span><xsl:attribute name="id">WebPartCaption<xsl:value-of select="DDF:WebPartQualifier"/></xsl:attribute><xsl:value-of select="WP:Title"/></span></nobr></a>
</xsl:when>
<xsl:otherwise>
<nobr><span><xsl:attribute name="id">WebPartCaption<xsl:value-of select="DDF:WebPartQualifier"/></xsl:attribute><xsl:value-of select="WP:Title"/></span></nobr>
</xsl:otherwise>
</xsl:choose>
</td>
<td nowrap="" class="DashPartCommandsArea">
<xsl:eval no-entities="t">"&nbsp;"</xsl:eval>
<xsl:if test="WP:HelpLink[.!='']">
<a target="_blank"><xsl:attribute name="name">__WPHelpLink<xsl:value-of select="DDF:WebPartQualifier"/></xsl:attribute><xsl:attribute name="href"><xsl:value-of select="WP:HelpLink"/></xsl:attribute><xsl:attribute name="title"><xsl:apply-templates select="//String[@_locID='L_PartHelpLinkTip_Text']"/></xsl:attribute><img class="DashPartHelp" style="cursor:hand;" border="0" src="help.gif"/></a>
</xsl:if>
<xsl:if test="WP:CustomizationLink[.!='']">
<a><xsl:attribute name="name">__WPCustLink<xsl:value-of select="DDF:WebPartQualifier"/></xsl:attribute><xsl:attribute name="href"><xsl:value-of select="WP:CustomizationLink"/></xsl:attribute><xsl:attribute name="title"><xsl:apply-templates select="//String[@_locID='L_CustomizationLinkTip_Text']"/></xsl:attribute><img style="cursor:hand" border="0" src="edit.gif"/></a>
</xsl:if>
<xsl:if test="WP:RequiresIsolation[.!='0']">
<a><xsl:attribute name="name">__WPRefreshLink<xsl:value-of select="DDF:WebPartQualifier"/></xsl:attribute><xsl:attribute name="href">JavaScript:OnRefreshClick(document.all.item("WebPart<xsl:value-of select="DDF:WebPartQualifier"/>"));</xsl:attribute><img class="DashPartRefresh" style="cursor:hand;" border="0" src="refresh.gif"><xsl:attribute name="title"><xsl:apply-templates select="//String[@_locID='L_RefreshTip_Text']"/></xsl:attribute></img></a>
</xsl:if>
<xsl:if test="DDF:CanPersonalize[.='1']">
<xsl:if test="WP:AllowMinimize[.='1']">
<xsl:choose>
<xsl:when test="WP:FrameState[.='0']">
<a><xsl:attribute name="name">__WPMinimizeLink<xsl:value-of select="DDF:WebPartQualifier"/></xsl:attribute><xsl:attribute name="href">JavaScript:OnMinRestoreClick(varPart<xsl:value-of select="DDF:WebPartQualifier"/>, document.all.item("WebPart<xsl:value-of select="DDF:WebPartQualifier"/>"));</xsl:attribute><img border="0" src="minus.gif"><xsl:attribute name="title"><xsl:apply-templates select="//String[@_locID='L_MinimizeTip_Text']"/></xsl:attribute></img></a>
</xsl:when>
<xsl:otherwise>
<a><xsl:attribute name="name">__WPRestoreLink<xsl:value-of select="DDF:WebPartQualifier"/></xsl:attribute><xsl:attribute name="href">JavaScript:OnMinRestoreClick(varPart<xsl:value-of select="DDF:WebPartQualifier"/>, document.all.item("WebPart<xsl:value-of select="DDF:WebPartQualifier"/>"));</xsl:attribute><img border="0" src="plus.gif"><xsl:attribute name="title"><xsl:apply-templates select="//String[@_locID='L_RestoreTip_Text']"/></xsl:attribute></img></a>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<xsl:if test="WP:AllowRemove[.='1']">
<a><xsl:attribute name="name">__WPCloseLink<xsl:value-of select="DDF:WebPartQualifier"/></xsl:attribute><xsl:attribute name="href">JavaScript:OnCloseClick(varPart<xsl:value-of select="DDF:WebPartQualifier"/>, document.all.item("WebPart<xsl:value-of select="DDF:WebPartQualifier"/>"));</xsl:attribute><img border="0" src="close.gif"><xsl:attribute name="title"><xsl:apply-templates select="//String[@_locID='L_CloseTip_Text']"/></xsl:attribute></img></a>
</xsl:if>
</xsl:if>
</td>
</tr>
</table>
<!-- Header End -->
<xsl:apply-templates select="."/>
</td>
</tr>
</table>
</div>
</xsl:for-each>
</xsl:template>



大家帮我看看,第三行的DIV
...全文
78 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
ssm1226 2003-10-09
  • 打赏
  • 举报
回复
<xsl:attribute name="ID"><xsl:eval>childNumber(this)</xsl:eval></xsl:attribute>
onekey 2003-10-09
  • 打赏
  • 举报
回复
页面出现: 关键字 xsl:number 可能不能用于名称空间 http://www.w3.org/TR/WD-xsl。 错误
怎么解决呢?
onekey 2003-10-09
  • 打赏
  • 举报
回复
怎么添加?我可以再“<div style="background-color: #FFCC00; layer-background-color: #FFCC00;">
” 后面直接添加

<xsl:attribute name="ID"><xsl:number value="position()" format="1"/></xsl:attribute> 可以吗?
colee 2003-10-09
  • 打赏
  • 举报
回复
<xsl:attribute name="ID"><xsl:number value="position()" format="1"/></xsl:attribute>

8,906

社区成员

发帖
与我相关
我的任务
社区描述
XML/XSL相关问题讨论专区
社区管理员
  • XML/XSL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧