一个 xml 表达式,请各位 V 友们帮忙。

2014-11-26 16:51:54 +08:00
 helloggn
想要的结果是:
<ul>
<li></li>....10个
</ul>
<ul>
<li></li>....10个
</ul>
<ul>
<li></li>....10个
</ul>
....
目前的输出是:
<li></li>
....无限

奉上源码 ,求帮忙
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ms="urn:schemas-microsoft-com:xslt"
xmlns:lewi="" xmlns:pe="labelproc" exclude-result-prefixes="pe ms lewi">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:param name="titleLength"/>
<xsl:param name="linkOpenType"/>
<xsl:template match="/">
<xsl:choose>
<xsl:when test="count(/NewDataSet/Table) = 0">
<li style="color:red">还没有任何项目!</li>
</xsl:when>

<xsl:otherwise>
<xsl:for-each select="/NewDataSet/Table">
<li>
<div class="pic">
<a>
<xsl:attribute name="href">
<xsl:value-of select="SiteUrl"/>
</xsl:attribute>
<xsl:attribute name="target">
<xsl:choose>
<xsl:when test="pe:GetNodeFieldName(NodeID, 'ItemOpenType') = 0">_self</xsl:when>
<xsl:otherwise>_blank</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:element name="img">
<xsl:attribute name="src">
<xsl:choose>
<xsl:when test="LogoUrl !=''">
<xsl:if test="pe:IsStartWithhttp(LogoUrl)='false'">
<xsl:value-of select="pe:UpLoadDir()"/>
</xsl:if>
<xsl:value-of select="LogoUrl"/>
</xsl:when>
<xsl:otherwise><xsl:value-of select="pe:UpLoadDir()"/>nopic.gif
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="border">0</xsl:attribute>
<xsl:attribute name="alt">
<xsl:value-of select="pe:CutText(Title,$titleLength,'…')"/>
</xsl:attribute>
</xsl:element>
</a>
</div>
<div class="title">
<a>
<xsl:attribute name="href">
<xsl:value-of select="SiteUrl"/>
</xsl:attribute>
<xsl:attribute name="target">
<xsl:choose>
<xsl:when test="pe:GetNodeFieldName(NodeID, 'ItemOpenType') = 0">_self</xsl:when>
<xsl:otherwise>_blank</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:value-of select="pe:CutText(Title,$titleLength,'…')"/>
</a>
</div>
</li>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
1203 次点击
所在节点    问与答
2 条回复
helloggn
2014-11-26 16:56:43 +08:00
顶起来》——》
helloggn
2014-11-26 17:31:30 +08:00
<xsl:if test="(position() mod 10)=1">
<ul>
</xsl:if>

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/149464

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX