문제
XLST에서 노드 세트의 길이를 어떻게 알 수 있습니까?
해결책
<xsl:variable name="length" select="count(nodeset)"/>
다른 팁
그것을 a에 넣을 필요가 없습니다
<xsl:variable name="length" select="count(nodes/node)"/>
하지만 ... 당신은 다음과 같이 인쇄 할 수 있습니다.
<xsl:value-of select="count(nodes/node)"/>
또는 다음과 같이 if-clause에서 사용하십시오.
<xsl:if test="count(comments/comment) > '0'">
<ul>
<xsl:apply-templates select="comments/comment"/>
</ul>
</xsl:if>
일반적으로 XSLT에서는 물건을 언급하지 않습니다 Arrays
, XSLT에는 실제로 그런 것이 없기 때문에. 기술 용어도 마찬가지입니다 nodesets
(0 개 이상의 노드로 구성) 또는 XSLT 2.0 sequences
.
제휴하지 않습니다 StackOverflow