다음을 통해 공유


msxsl:node-set() 함수에 대한 지원

msxsl:node-set 함수를 사용하면 결과 트리 조각을 노드 집합으로 변환할 수 있습니다. 결과로 만들어지는 노드 집합은 트리의 루트 노드로서 항상 단일 노드를 포함합니다.

참고참고

XslTransform 클래스는 .NET Framework 버전 2.0에서 사용되지 않습니다.XslCompiledTransform 클래스를 사용하여 XSLT(Extensible Stylesheet Language for Transformations) 변환을 수행할 수 있습니다.자세한 내용은 XslCompiledTransform 클래스 사용XslTransform 클래스에서 마이그레이션을 참조하십시오.

msxsl:node-set 함수를 사용하면 결과 트리 조각을 노드 집합으로 변환할 수 있습니다. 결과로 만들어지는 노드 집합은 트리의 루트 노드로서 항상 단일 노드를 포함합니다.

예제

다음 예제에서 $var는 스타일시트의 노드 트리인 변수입니다. for-each 문과 node-set 함수를 함께 사용하면 이 노드 트리를 노드 집합으로 반복할 수 있습니다.

nodeset.xsl

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:msxsl="urn:schemas-microsoft-com:xslt"
                xmlns:user="https://www.contoso.com"
                version="1.0">
    <xsl:variable name="books">
        <book author="Michael Howard">Writing Secure Code</book>
        <book author="Michael Kay">XSLT Reference</book>
    </xsl:variable>

    <xsl:template match="/">
        <authors>
            <xsl:for-each select="msxsl:node-set($books)/book"> 
                <author><xsl:value-of select="@author"/)</author>
            </xsl:for-each>
        </authors>
    </xsl:template>
</xsl:stylesheet>

출력

변환 결과

<?xml version="1.0" encoding="utf-8"?>
<authors><author>Michael Howard</author><author>Michael Kay</author></authors>

참고 항목

개념

XslTransform 클래스의 XSLT 프로세서 구현