V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
helloggn
V2EX  ›  问与答

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

  •  
  •   helloggn · 2014-11-26 16:51:54 +08:00 · 1203 次点击
    这是一个创建于 3610 天前的主题,其中的信息可能已经有所发展或是发生改变。
    想要的结果是:
    <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>
    helloggn
        1
    helloggn  
    OP
       2014-11-26 16:56:43 +08:00
    顶起来》——》
    helloggn
        2
    helloggn  
    OP
       2014-11-26 17:31:30 +08:00
    <xsl:if test="(position() mod 10)=1">
    <ul>
    </xsl:if>
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   988 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 22:14 · PVG 06:14 · LAX 15:14 · JFK 18:14
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.