首页 新闻 会员 周边

一个xml表达式,请各位帮帮忙

0
悬赏园豆:100 [已关闭问题] 关闭于 2015-01-18 22:52

想要的输出结果是:

<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>
xml
问题补充:
 <xsl:if test="(position() mod 10)=1">
                    <ul>
                   </xsl:if> 
能算思路么。提高悬赏100。 大家快来看看啊
村长很忙的主页 村长很忙 | 初学一级 | 园豆:125
提问于:2014-11-26 16:14
< >
分享
所有回答(3)
0
xiaocong_soft | 园豆:556 (小虾三级) | 2014-11-27 11:48

谢谢指点。

支持(0) 反对(0) 村长很忙 | 园豆:125 (初学一级) | 2014-11-27 17:31
0

我觉得你补充的思路就可以啊

<xsl:if test="(position() mod 10)=0">
                    <ul>
                   </xsl:if> 

<xsl:if test="(position() mod 10)=9">
                    </ul>
                   </xsl:if> 

即mod 10=0的时候,前面加<ul>; mod 1=9的时候,后面加</ul>, 总数mod 10>0, z最后加</ul>

万里沙来手一挥 | 园豆:196 (初学一级) | 2014-11-27 22:09
0

可怜的我的100豆豆,现在还是没有人回答

村长很忙 | 园豆:125 (初学一级) | 2014-12-05 16:30
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册