xsl限定显示行数问题。

yangbobo1992 2012-09-28 10:03:27
比如我有20组数据。我只想显示5组。。有什么办法可以解决?
...全文
234 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
海大富运动 2012-10-31
  • 打赏
  • 举报
回复
这个在你做数据处理的时候就应该弄好的!

yangbobo1992 2012-09-28
  • 打赏
  • 举报
回复
诶有人来么?
XSL是这个样子的。
给位大神,能否帮忙解决。小弟感激不尽。
<?xml version="1.0" encoding="gb2312"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:user="http://mycompany.com/mynamespace">
<xsl:template match="response">
<xsl:variable name="code1" select="//response/airports/row[1]/code"></xsl:variable>
<xsl:variable name="code2" select="//response/airports/row[2]/code"></xsl:variable>

<table align="center" width="100%" border="1" cellspacing="0" cellpadding="0"
style="border-collapse:collapse;" bordercolor="#D7E7F7">
<div id="text" style="visibility:hidden;position:absolute;border-width:1px;background-color:White;border-color:#6595d6;border-style:solid;width:250px;height:100px;">
</div>
<tr style="background-color: #EFF4FA;" align="center" height="25px">
<td colspan="14" align="center" style="font-size:15px" >
单程:
<strong>
<xsl:variable name="depar2" select="availableJourneys/availableJourney/departureAirport"></xsl:variable>
<xsl:if test="contains($depar2,$code1)">
<xsl:value-of select="//response/airports/row[1]/name" />
</xsl:if>
<xsl:if test="contains($depar2,$code2)">
<xsl:value-of select="//response/airports/row[2]/name" />
</xsl:if>

</strong>(
<xsl:variable name="departureDate" select="availableJourneys/availableJourney/availJourneyOptions/availJourneyOption/flightSegments/flightSegment/departureDateTime"></xsl:variable>
<xsl:value-of select="substring($departureDate,1,4)"/>-
<xsl:value-of select="substring($departureDate,6,2)"/>-
<xsl:value-of select="substring($departureDate,9,2)"/>
) <img src="/ECS/common/images/icon_to_grey_array_back2.gif"/> 
<strong>
<xsl:variable name="arriv2" select="availableJourneys/availableJourney/arrivalAirport"></xsl:variable>
<xsl:if test="contains($arriv2,$code1)">
<xsl:value-of select="//response/airports/row[1]/name" />
</xsl:if>
<xsl:if test="contains($arriv2,$code2)">
<xsl:value-of select="//response/airports/row[2]/name" />
</xsl:if>
</strong>

</td>
</tr>
<tr style="background-color: #EFF4FA;">
<td width="80" rowspan="2" align="center">推荐理由</td>
<td width="50" rowspan="2" align="center">航班号</td>
<td width="30" rowspan="2" align="center">起飞机场</td>
<td width="30" rowspan="2" align="center">到达机场</td>
<td width="50" rowspan="2" align="center">起飞时间</td>
<td width="50" rowspan="2" align="center">到达时间</td>
<td width="50" rowspan="2" align="center">机型</td>
<td width="30" rowspan="2" align="center">经停</td>
<td width="30" rowspan="2" align="center">配餐</td>
<td width="45" rowspan="2" align="center">头等舱</td>
<td width="45" rowspan="2" align="center">公务舱</td>
<td width="60" rowspan="2" align="center">高端经济舱</td>
<td width="45" rowspan="2" align="center">经济舱</td>
<td width="45" rowspan="2" align="center">最低价</td>
</tr>
<tr></tr>

<xsl:for-each select="availableJourneys/availableJourney/availJourneyOptions/availJourneyOption">
<!-- <xsl:sort select="flightSegments/flightSegment/departureDateTime" order="ascending"/>
<xsl:sort select="flightSegments/flightSegment" order="ascending"/> -->
<xsl:variable name="rph0" select="rph"></xsl:variable>
<xsl:variable name="position1" select="position()"></xsl:variable>
<xsl:variable name="flightNumber1" select="flightSegments/flightSegment/flightNumber"></xsl:variable>
<xsl:variable name="marketingCarrier1" select="flightSegments/flightSegment/marketingCarrier"></xsl:variable>
<xsl:variable name="departureLocation1" select="flightSegments/flightSegment/departureLocation"></xsl:variable>
<xsl:variable name="arrivalLocation1" select="flightSegments/flightSegment/arrivalLocation"></xsl:variable>
<xsl:variable name="departureDateTime1" select="flightSegments/flightSegment/departureDateTime"></xsl:variable>
<xsl:variable name="arrivalDateTime1" select="flightSegments/flightSegment/arrivalDateTime"></xsl:variable>
<xsl:variable name="equipmentCode1" select="flightSegments/flightSegment/equipmentCode"></xsl:variable>

<tr style="background-color: #FFFFFF">
<td width="80" id="getre" height="30" name="getre"><!--
低价推荐第<xsl:value-of select="position()" />组
--></td>
<td align="center" width="50" height="30">
<xsl:value-of select="flightSegments/flightSegment/marketingCarrier" />
<xsl:value-of select="flightSegments/flightSegment/flightNumber" />
</td>
<td align="center" width="30" height="30">
<xsl:variable name="depar" select="//availableJourneys/availableJourney/departureAirport"></xsl:variable>
<xsl:if test="contains($depar,$code1)">
<xsl:value-of select="//response/airports/row[1]/name" />
</xsl:if>
<xsl:if test="contains($depar,$code2)">
<xsl:value-of select="//response/airports/row[2]/name" />
</xsl:if>

</td>
<td align="center" width="40" height="30">
<xsl:variable name="arriv" select="//availableJourneys/availableJourney/arrivalAirport"></xsl:variable>
<xsl:if test="contains($arriv,$code1)">
<xsl:value-of select="//response/airports/row[1]/name" />
</xsl:if>
<xsl:if test="contains($arriv,$code2)">
<xsl:value-of select="//response/airports/row[2]/name" />
</xsl:if>
</td>
<td width="50" height="30">
<xsl:variable name="departureTime" select="flightSegments/flightSegment/departureDateTime" ></xsl:variable>
<xsl:value-of select="substring($departureTime,12)" />
</td>
<td width="50" height="30">
<xsl:variable name="arrivalTime" select="flightSegments/flightSegment/arrivalDateTime" ></xsl:variable>
<xsl:value-of select="substring($arrivalTime,12)" />
</td>
<td align="center" width="50" height="30">
<xsl:value-of select="flightSegments/flightSegment/equipmentCode" />
</td>
<td align="center" width="30" height="30">
<xsl:value-of select="flightSegments/flightSegment/stopNumber" />
</td>
<td align="center" width="30" height="30">
<xsl:variable name="meal" select="flightSegments/flightSegment/hasMeal"></xsl:variable>
<xsl:if test="contains($meal,'false')">无</xsl:if>
<xsl:if test="contains($meal,'true')">有</xsl:if>
</td>
<td id="getPrice{$position1}1" width="80" height="30" onclick="selectFlight(this.id)"
onmouseover="ft_mouseover(this.id)" onmouseout="ft_mouseout(this.id)">
<xsl:for-each select="//response/totalPrices/tripPrices/tripPrice">
<xsl:sort select="totalAmount"/>
<xsl:variable name="totalAmount1" select="totalAmount"></xsl:variable>
<xsl:variable name="seqNum1" select="seqNum"></xsl:variable>
<xsl:variable name="cabin01" select="fareRuleInfos/fareRuleInfo/bookCodes/bookCode/cabin"></xsl:variable>
<xsl:variable name="cabin1" select="fareRuleInfos/fareRuleInfo/bookCodes/bookCode/resBookDesigCode"></xsl:variable>
<xsl:variable name="fareReference" select="fareRuleInfos/fareRuleInfo/fareReference"></xsl:variable>
<xsl:variable name="filingAirline" select="fareRuleInfos/fareRuleInfo/filingAirline"></xsl:variable>
<xsl:variable name="departureLocation" select="fareRuleInfos/fareRuleInfo/departureLocation"></xsl:variable>
<xsl:variable name="arrivalLocation" select="fareRuleInfos/fareRuleInfo/arrivalLocation"></xsl:variable>
<xsl:variable name="ruleReference1" select="fareRuleInfos/fareRuleInfo/ruleReference1"></xsl:variable>
<xsl:variable name="ruleReference2" select="fareRuleInfos/fareRuleInfo/ruleReference2"></xsl:variable>

<xsl:if test="contains($cabin01,'FIRST')">
<xsl:for-each select="//response/totalPrices/availJourneyBindings/availJourneyBinding">
<xsl:variable name="seqNum2" select="seqNum"></xsl:variable>
<xsl:for-each select="avOptionRphs/avOptionRph">
<xsl:variable name="rph1" select="rph"></xsl:variable>
<!--<xsl:value-of select="$rph1"/><xsl:value-of select="$seqNum2"/>
--><xsl:choose>
<xsl:when
test="contains($rph1,$rph0)">
<xsl:if test="contains($seqNum2,$seqNum1)">
<label flightNumber1="{$flightNumber1}" departureLocation1="{$departureLocation1}" arrivalDateTime1="{$arrivalDateTime1}"
arrivalLocation1="{$arrivalLocation1}" departureDateTime1="{$departureDateTime1}" cabin1="{$cabin1}" equipmentCode1="{$equipmentCode1}"
marketingCarrier1="{$marketingCarrier1}" fareReference="{$fareReference}" id="getPrice{$position1}1prop"
filingAirline="{$filingAirline}" departureLocation="{$departureLocation}" arrivalLocation="{$arrivalLocation}"
ruleReference1="{$ruleReference1}" ruleReference2="{$ruleReference2}" >
<xsl:value-of select="$totalAmount1" />
</label>
</xsl:if>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
</xsl:if>
</xsl:for-each>
</td>

</xsl:template>
</xsl:stylesheet>

8,909

社区成员

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

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