2012-09-16 3 views
0

루프에서 첫 번째 레코드 만 가져 오려고합니다. 또는 첫 번째 레코드 후에이 루프를 어떻게 중지 할 수 있습니까?JSTL을 사용하여 XML 구문 분석

<x:parse var="taggedData" xml="${taggedLoad}"/> 
<x:forEach var="item" select="$taggedData//item" varStatus="status"> 
    <h4> 
     <a href="/go/video/index.jsp?videoId=<str:substring start="5"><x:out select="$item/guid"/></str:substring>" onclick="javascript:loadBCvideo(<str:substring start="5"><x:out select="$item/guid"/></str:substring>); return false;"><x:out select="$item/title" /></a> 
    </h4> 
    <p> 
     <x:out select="$item/description" escapeXml="false" /> 
    </p> 

답변

0

당신은 사용할 수 있습니다

<xsl:for-each select="(//*[local-name()='item'])[position() &lt;= 1]"> 

나 :

def result = records.children().find { 
    domain -> [email protected]_name == targetDomain 
} 

result.children().each { 
    // do stuff 
}