XslCompiledTransform.Load 메서드

정의

스타일시트를 컴파일합니다.

오버로드

Name Description
Load(IXPathNavigable, XsltSettings, XmlResolver)

에 포함된 XSLT 스타일시트를 IXPathNavigable컴파일합니다. XSLT XmlResolverimport 또는 include 요소를 확인하고 XSLT 설정에 따라 스타일시트에 대한 사용 권한이 결정됩니다.

Load(String, XsltSettings, XmlResolver)

URI에 지정된 XSLT 스타일시트를 로드하고 컴파일합니다. XSLT XmlResolverimport 또는 include 요소를 확인하고 XSLT 설정에 따라 스타일시트에 대한 사용 권한이 결정됩니다.

Load(MethodInfo, Byte[], Type[])

유틸리티를 사용하여 컴파일된 스타일시트에서 메서드를 로드합니다 XSLTC.exe .

Load(XmlReader, XsltSettings, XmlResolver)

에 포함된 XSLT 스타일시트를 XmlReader컴파일합니다. XSLT XmlResolverimport 또는 include 요소를 확인하고 XSLT 설정에 따라 스타일시트에 대한 사용 권한이 결정됩니다.

Load(XmlReader)

에 포함된 스타일시트를 컴파일합니다 XmlReader.

Load(Type)

XSLT 컴파일러(xsltc.exe)를 사용하여 만든 컴파일된 스타일시트를 로드합니다.

Load(String)

지정된 URI에 있는 스타일시트를 로드하고 컴파일합니다.

Load(IXPathNavigable)

개체에 포함된 스타일시트를 컴파일합니다 IXPathNavigable .

설명

클래스의 XslCompiledTransform 전반적인 성능이 클래스보다 XslTransform 우수하지만 클래스 Load 메서드 XslCompiledTransform 는 변환 시 처음 호출될 때 클래스의 Load 메서드보다 XslTransform 더 느리게 수행될 수 있습니다. 이는 XSLT 파일을 로드하기 전에 컴파일해야 하기 때문입니다. 자세한 내용은 다음 블로그 게시물을 참조하세요. XslCompiledTransform이 XslTransform보다 느리나요?

메모

디버그 모드에서 컴파일된 XSLT와 릴리스 모드에서 컴파일된 XSLT 간에는 차이가 있습니다. 경우에 따라 디버그 모드에서 컴파일된 스타일시트가 오류가 Loadthrow되지 않지만 나중에 Transform실패합니다. 릴리스 모드에서 컴파일된 동일한 스타일시트가 실패합니다 Load. 이러한 동작의 예는 노드 집합 형식이 아닌 변수가 노드 집합이 필요한 식에 할당되는 경우입니다.

Load(IXPathNavigable, XsltSettings, XmlResolver)

Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs

에 포함된 XSLT 스타일시트를 IXPathNavigable컴파일합니다. XSLT XmlResolverimport 또는 include 요소를 확인하고 XSLT 설정에 따라 스타일시트에 대한 사용 권한이 결정됩니다.

public:
 void Load(System::Xml::XPath::IXPathNavigable ^ stylesheet, System::Xml::Xsl::XsltSettings ^ settings, System::Xml::XmlResolver ^ stylesheetResolver);
public void Load(System.Xml.XPath.IXPathNavigable stylesheet, System.Xml.Xsl.XsltSettings? settings, System.Xml.XmlResolver? stylesheetResolver);
public void Load(System.Xml.XPath.IXPathNavigable stylesheet, System.Xml.Xsl.XsltSettings settings, System.Xml.XmlResolver stylesheetResolver);
member this.Load : System.Xml.XPath.IXPathNavigable * System.Xml.Xsl.XsltSettings * System.Xml.XmlResolver -> unit
Public Sub Load (stylesheet As IXPathNavigable, settings As XsltSettings, stylesheetResolver As XmlResolver)

매개 변수

stylesheet
IXPathNavigable

인터페이스를 구현하는 개체입니다 IXPathNavigable . Microsoft .NET Framework에서 이는 스타일시트를 XmlNode 포함하는 (일반적으로 XmlDocument) XPathDocument 일 수 있습니다.

settings
XsltSettings

XsltSettings 스타일시트에 적용할 값입니다. 이 null경우 설정이 Default 적용됩니다.

stylesheetResolver
XmlResolver

XmlResolver XSLT importinclude 요소에서 참조되는 스타일시트를 확인하는 데 사용됩니다. 이 null경우 외부 리소스가 확인되지 않습니다.

예외

stylesheet 값은 null.

스타일시트에 오류가 있습니다.

예제

다음은 스타일시트를 로드하는 예제입니다. 개체에는 XmlSecureResolver 스타일시트에 있는 요소 또는 include 모든 import 요소에 액세스하는 데 필요한 자격 증명이 포함됩니다.

// Create a resolver and specify the necessary credentials.
XmlUrlResolver resolver = new XmlUrlResolver();
System.Net.NetworkCredential myCred;
myCred  = new System.Net.NetworkCredential(UserName,SecurelyStoredPassword,Domain);
resolver.Credentials = myCred;

// Load the style sheet.
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load(new XPathDocument("http://serverName/data/xsl/sort.xsl"), XsltSettings.Default, resolver);
' Create a resolver and specify the necessary credentials.
Dim resolver As New XmlUrlResolver()
Dim myCred As System.Net.NetworkCredential
myCred = New System.Net.NetworkCredential(UserName, SecurelyStoredPassword, Domain)
resolver.Credentials = myCred
        
' Load the style sheet.
Dim xslt As New XslCompiledTransform()
xslt.Load(New XPathDocument("http://serverName/data/xsl/sort.xsl"), XsltSettings.Default, resolver)

설명

클래스는 XslCompiledTransform XSLT 1.0 구문을 지원합니다. XSLT 스타일시트는 네임스페이스를 http://www.w3.org/1999/XSL/Transform 사용해야 합니다.

추가 정보

적용 대상

Load(String, XsltSettings, XmlResolver)

Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs

URI에 지정된 XSLT 스타일시트를 로드하고 컴파일합니다. XSLT XmlResolverimport 또는 include 요소를 확인하고 XSLT 설정에 따라 스타일시트에 대한 사용 권한이 결정됩니다.

public:
 void Load(System::String ^ stylesheetUri, System::Xml::Xsl::XsltSettings ^ settings, System::Xml::XmlResolver ^ stylesheetResolver);
public void Load(string stylesheetUri, System.Xml.Xsl.XsltSettings? settings, System.Xml.XmlResolver? stylesheetResolver);
public void Load(string stylesheetUri, System.Xml.Xsl.XsltSettings settings, System.Xml.XmlResolver stylesheetResolver);
member this.Load : string * System.Xml.Xsl.XsltSettings * System.Xml.XmlResolver -> unit
Public Sub Load (stylesheetUri As String, settings As XsltSettings, stylesheetResolver As XmlResolver)

매개 변수

stylesheetUri
String

스타일시트 URI입니다.

settings
XsltSettings

XsltSettings 스타일시트에 적용할 값입니다. 이 null경우 설정이 Default 적용됩니다.

stylesheetResolver
XmlResolver

XmlResolver 스타일시트 URI 및 XSLT importinclude 및 요소에서 참조되는 모든 스타일시트를 확인하는 데 사용됩니다.

예외

stylesheetUri 또는 stylesheetResolver 값이 .입니다null.

스타일시트에 오류가 있습니다.

스타일시트를 찾을 수 없습니다.

이 값에는 stylesheetUri 찾을 수 없는 파일 이름 또는 디렉터리가 포함됩니다.

값을 stylesheetUri 확인할 수 없습니다.

-또는-

요청을 처리하는 동안 오류가 발생했습니다.

stylesheetUri 가 유효한 URI가 아닌 경우

스타일시트를 로드하는 동안 구문 분석 오류가 발생했습니다.

예제

다음 예제에서는 네트워크 리소스에 저장된 스타일시트를 로드합니다. 개체는 XmlSecureResolver 스타일시트에 액세스하는 데 필요한 자격 증명을 지정합니다.

// Create the XslCompiledTransform object.
XslCompiledTransform xslt = new XslCompiledTransform();

// Create a resolver and set the credentials to use.
XmlSecureResolver resolver = new XmlSecureResolver(new XmlUrlResolver(), "http://serverName/data/");
resolver.Credentials = CredentialCache.DefaultCredentials;

// Load the style sheet.
xslt.Load("http://serverName/data/xsl/sort.xsl", null, resolver);
' Create the XslCompiledTransform object.
Dim xslt As New XslCompiledTransform()
        
' Create a resolver and set the credentials to use.
Dim resolver As New XmlSecureResolver(New XmlUrlResolver(), "http://serverName/data/")
resolver.Credentials = CredentialCache.DefaultCredentials
        
' Load the style sheet.
xslt.Load("http://serverName/data/xsl/sort.xsl", Nothing, resolver)

설명

클래스는 XslCompiledTransform XSLT 1.0 구문을 지원합니다. XSLT 스타일시트는 네임스페이스를 http://www.w3.org/1999/XSL/Transform 사용해야 합니다.

XmlReader 기본 설정은 스타일시트를 로드하는 데 사용됩니다. 에서 DTD 처리를 사용할 수 XmlReader없습니다. DTD 처리가 필요한 경우 이 기능을 사용하도록 설정한 상태로 XmlReader 만들고 메서드에 Load 전달합니다.

추가 정보

적용 대상

Load(MethodInfo, Byte[], Type[])

Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs

유틸리티를 사용하여 컴파일된 스타일시트에서 메서드를 로드합니다 XSLTC.exe .

public:
 void Load(System::Reflection::MethodInfo ^ executeMethod, cli::array <System::Byte> ^ queryData, cli::array <Type ^> ^ earlyBoundTypes);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("This method will call into constructors of the earlyBoundTypes array which cannot be statically analyzed.")]
public void Load(System.Reflection.MethodInfo executeMethod, byte[] queryData, Type[]? earlyBoundTypes);
public void Load(System.Reflection.MethodInfo executeMethod, byte[] queryData, Type[]? earlyBoundTypes);
public void Load(System.Reflection.MethodInfo executeMethod, byte[] queryData, Type[] earlyBoundTypes);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("This method will call into constructors of the earlyBoundTypes array which cannot be statically analyzed.")>]
member this.Load : System.Reflection.MethodInfo * byte[] * Type[] -> unit
member this.Load : System.Reflection.MethodInfo * byte[] * Type[] -> unit
Public Sub Load (executeMethod As MethodInfo, queryData As Byte(), earlyBoundTypes As Type())

매개 변수

executeMethod
MethodInfo

MethodInfo 컴파일된 스타일시트에서 컴파일러에서 execute 생성된 메서드를 나타내는 개체입니다.

queryData
Byte[]

메서드에서 생성된 컴파일된 스타일시트 필드에 있는 serialize된 CompileToType(XmlReader, XsltSettings, XmlResolver, Boolean, TypeBuilder, String) 데이터 구조 staticData 의 바이트 배열입니다.

earlyBoundTypes
Type[]

컴파일된 스타일시트에서 컴파일러 생성 ebTypes 필드에 저장된 형식의 배열입니다.

특성

예제

아래 코드 예제에서는 컴파일된 스타일시트를 로드하는 데 사용합니다 Load . 변환은 요소의 Price 값을 10% 줄입니다.

using System;
using System.IO;
using System.Reflection;
using System.Xml;
using System.Xml.Xsl;

class Example
{
    static void Main()
    {
        // Load a stylesheet compiled using the XSLTC.EXE utility
        Type compiledStylesheet = Assembly.Load("Transform").GetType("Transform");

        // Extract private members from the compiled stylesheet
        BindingFlags bindingFlags = BindingFlags.NonPublic | BindingFlags.Static;
        MethodInfo executeMethod = compiledStylesheet.GetMethod("Execute", bindingFlags);
        object staticData = compiledStylesheet.GetField("staticData", bindingFlags).GetValue(null);
        object earlyBoundTypes = compiledStylesheet.GetField("ebTypes", bindingFlags).GetValue(null);

        // Load into XslCompiledTransform
        XslCompiledTransform xslt = new XslCompiledTransform();
        xslt.Load(executeMethod, (byte[])staticData, (Type[])earlyBoundTypes);

        // Run the transformation
        xslt.Transform(XmlReader.Create(new StringReader("<Root><Price>9.50</Price></Root>")), (XsltArgumentList)null, Console.Out);
    }
}
Imports System.IO
Imports System.Reflection
Imports System.Xml
Imports System.Xml.Xsl

Module Module1

    Sub Main()
        ' Load a stylesheet compiled using the XSLTC.EXE utility
        Dim compiledStylesheet As Type = [Assembly].Load("Transform").GetType("Transform")

        ' Extract private members from the compiled stylesheet
        Dim bindingFlags As BindingFlags = bindingFlags.NonPublic Or bindingFlags.Static
        Dim executeMethod As MethodInfo = compiledStylesheet.GetMethod("Execute", bindingFlags)
        Dim staticData As Object = compiledStylesheet.GetField("staticData", bindingFlags).GetValue(Nothing)
        Dim earlyBoundTypes As Object = compiledStylesheet.GetField("ebTypes", bindingFlags).GetValue(Nothing)

        ' Load into XslCompiledTransform
        Dim xslt As New XslCompiledTransform()
        xslt.Load(executeMethod, CType(staticData, Byte()), CType(earlyBoundTypes, Type()))

        ' Run the transformation
        xslt.Transform(XmlReader.Create(New StringReader("<Root><Price>9.50</Price></Root>")), CType(Nothing, XsltArgumentList), Console.Out)
    End Sub
End Module

메모

이 예제에 사용된 "Transform" 어셈블리는 xsltc.exe 유틸리티를 사용하여 빌드되었습니다. 이 명령줄 도구 사용에 대한 자세한 내용은 방법: 어셈블리를 사용하여 XSLT 변환 수행을 참조하세요.

이전 코드 예제에서는 다음 변환을 사용합니다.

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:msxsl="urn:schemas-microsoft-com:xslt"
  xmlns:user="urn:my-scripts">
  <msxsl:script language="C#" implements-prefix="user">
    <![CDATA[
  public double modifyPrice(double price){
    price*=0.9;
    return price;
  }
  ]]>
  </msxsl:script>
  <xsl:template match="Root">
    <Root xmlns="">
      <Price><xsl:value-of select="user:modifyPrice(Price)"/></Price>
    </Root>
  </xsl:template>
</xsl:stylesheet>

설명

이 메서드는 개체, 바이트 배열 및 형식 배열 형식으로 MethodInfo 컴파일된 스타일시트를 허용합니다. DynamicMethod 개체를 사용하여 개체를 회수할 때 XslCompiledTransform 컴파일된 스타일시트 메서드를 삭제할 수 있습니다.

적용 대상

Load(XmlReader, XsltSettings, XmlResolver)

Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs

에 포함된 XSLT 스타일시트를 XmlReader컴파일합니다. XSLT XmlResolverimport 또는 include 요소를 확인하고 XSLT 설정에 따라 스타일시트에 대한 사용 권한이 결정됩니다.

public:
 void Load(System::Xml::XmlReader ^ stylesheet, System::Xml::Xsl::XsltSettings ^ settings, System::Xml::XmlResolver ^ stylesheetResolver);
public void Load(System.Xml.XmlReader stylesheet, System.Xml.Xsl.XsltSettings? settings, System.Xml.XmlResolver? stylesheetResolver);
public void Load(System.Xml.XmlReader stylesheet, System.Xml.Xsl.XsltSettings settings, System.Xml.XmlResolver stylesheetResolver);
member this.Load : System.Xml.XmlReader * System.Xml.Xsl.XsltSettings * System.Xml.XmlResolver -> unit
Public Sub Load (stylesheet As XmlReader, settings As XsltSettings, stylesheetResolver As XmlResolver)

매개 변수

stylesheet
XmlReader

XmlReader 스타일시트를 포함하는 항목입니다.

settings
XsltSettings

XsltSettings 스타일시트에 적용할 값입니다. 이 null경우 설정이 Default 적용됩니다.

stylesheetResolver
XmlResolver

XmlResolver XSLT importinclude 요소에서 참조되는 스타일시트를 확인하는 데 사용됩니다. 이 null경우 외부 리소스가 확인되지 않습니다.

예외

stylesheet 값은 null.

스타일시트에 오류가 있습니다.

예제

다음 예제에서는 스타일시트를 로드하고 XSLT 스크립팅을 지원합니다.

// Create the XslCompiledTransform object.
XslCompiledTransform xslt = new XslCompiledTransform();

// Create a resolver and set the credentials to use.
XmlSecureResolver resolver = new XmlSecureResolver(new XmlUrlResolver(), "http://serverName/data/");
resolver.Credentials = CredentialCache.DefaultCredentials;

XmlReader reader = XmlReader.Create("http://serverName/data/xsl/sort.xsl");

// Create the XsltSettings object with script enabled.
XsltSettings settings = new XsltSettings(false,true);

// Load the style sheet.
xslt.Load(reader, settings, resolver);
' Create the XslCompiledTransform object.
Dim xslt As New XslCompiledTransform()
        
' Create a resolver and set the credentials to use.
Dim resolver As New XmlSecureResolver(New XmlUrlResolver(), "http://serverName/data/")
resolver.Credentials = CredentialCache.DefaultCredentials
        
Dim reader As XmlReader = XmlReader.Create("http://serverName/data/xsl/sort.xsl")
        
' Create the XsltSettings object with script enabled.
Dim settings As New XsltSettings(False, True)
        
' Load the style sheet.
xslt.Load(reader, settings, resolver)

설명

클래스는 XslCompiledTransform XSLT 1.0 구문을 지원합니다. XSLT 스타일시트는 네임스페이스를 http://www.w3.org/1999/XSL/Transform 사용해야 합니다.

스타일시트가 모든 자식을 통해 현재 노드 XmlReader 에서 로드됩니다. 이렇게 하면 문서의 일부를 스타일시트로 사용할 수 있습니다. 메서드가 Load 완료되면 XmlReader 스타일시트가 끝난 후 다음 노드에 배치됩니다. 문서의 끝에 도달하면 XmlReader가 파일의 끝(EOF)에 위치합니다.

추가 정보

적용 대상

Load(XmlReader)

Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs

에 포함된 스타일시트를 컴파일합니다 XmlReader.

public:
 void Load(System::Xml::XmlReader ^ stylesheet);
public void Load(System.Xml.XmlReader stylesheet);
member this.Load : System.Xml.XmlReader -> unit
Public Sub Load (stylesheet As XmlReader)

매개 변수

stylesheet
XmlReader

XmlReader 스타일시트를 포함하는 항목입니다.

예외

stylesheet 값은 null.

스타일시트에 오류가 있습니다.

예제

다음은 개체에 포함된 스타일시트를 로드하는 예제입니다 XmlReader .

// Create a reader that contains the style sheet.
XmlReader reader = XmlReader.Create("titles.xsl");
reader.ReadToDescendant("xsl:stylesheet");

// Load the style sheet.
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load(reader);
' Create a reader that contains the style sheet.
Dim reader As XmlReader = XmlReader.Create("titles.xsl")
reader.ReadToDescendant("xsl:stylesheet")
        
' Load the style sheet.
Dim xslt As New XslCompiledTransform()
xslt.Load(reader)

설명

클래스는 XslCompiledTransform XSLT 1.0 구문을 지원합니다. XSLT 스타일시트는 네임스페이스를 http://www.w3.org/1999/XSL/Transform 사용해야 합니다.

스타일시트가 모든 자식을 통해 현재 노드 XmlReader 에서 로드됩니다. 이렇게 하면 문서의 일부를 스타일시트로 사용할 수 있습니다. 메서드가 Load 완료되면 XmlReader 스타일시트가 끝난 후 다음 노드에 배치됩니다. 문서의 끝에 도달하면 XmlReader가 파일의 끝(EOF)에 위치합니다.

이 메서드의 동작은 다음과 같습니다.

  • XmlUrlResolver 사용자 자격 증명이 없는 항목은 모든 xsl:import 요소 또는 xsl:include 요소를 처리하는 데 사용됩니다.

  • 함수를 document() 사용할 수 없습니다.

  • 포함된 스크립트는 지원되지 않습니다.

오버로드를 Load(XmlReader, XsltSettings, XmlResolver) 사용하여 필요한 인증 자격 증명을 XmlResolver 사용하여 지정하거나 다른 XSLT 설정을 지정할 수 있습니다.

추가 정보

적용 대상

Load(Type)

Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs

XSLT 컴파일러(xsltc.exe)를 사용하여 만든 컴파일된 스타일시트를 로드합니다.

public:
 void Load(Type ^ compiledStylesheet);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("This method will get fields and types from the assembly of the passed in compiledStylesheet and call their constructors which cannot be statically analyzed")]
public void Load(Type compiledStylesheet);
public void Load(Type compiledStylesheet);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("This method will get fields and types from the assembly of the passed in compiledStylesheet and call their constructors which cannot be statically analyzed")>]
member this.Load : Type -> unit
member this.Load : Type -> unit
Public Sub Load (compiledStylesheet As Type)

매개 변수

compiledStylesheet
Type

컴파일된 스타일시트를 포함하는 클래스의 이름입니다.

일반적으로 스타일시트 이름입니다. 달리 지정하지 않는 한 xsltc.exe 도구는 클래스 및 어셈블리 이름에 스타일시트 이름을 사용합니다.

특성

예제

다음 예제에서는 XSLT 어셈블리에서 컴파일된 스타일시트를 로드하는 방법을 보여 줍니다. 이 예제에서는 xsltc.exe 도구가 bookOrders라는 클래스를 사용하여 bookOrders.dll 어셈블리를 만드는 데 사용되었다고 가정합니다.

메모

코드를 컴파일할 때 XSLT 어셈블리를 참조해야 합니다. csc /r:system.dll;system.xml.dll;bookOrders.dll myCode.cs을 예로 들 수 있습니다.

// Load the type of the class.
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load(typeof(bookOrders));

설명

xsltc.exe 도구는 스타일시트를 컴파일하고 스타일시트에서 어셈블리를 생성하는 데 사용됩니다. 메서드는 Load 어셈블리에서 컴파일된 스타일시트를 로드합니다.

메모

또한 XSLT 어셈블리를 애플리케이션에 참조로 포함해야 합니다.

추가 정보

적용 대상

Load(String)

Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs

지정된 URI에 있는 스타일시트를 로드하고 컴파일합니다.

public:
 void Load(System::String ^ stylesheetUri);
public void Load(string stylesheetUri);
member this.Load : string -> unit
Public Sub Load (stylesheetUri As String)

매개 변수

stylesheetUri
String

스타일시트 URI입니다.

예외

stylesheetUri 값은 null.

스타일시트에 오류가 있습니다.

스타일시트를 찾을 수 없습니다.

이 값에는 stylesheetUri 찾을 수 없는 파일 이름 또는 디렉터리가 포함됩니다.

값을 stylesheetUri 확인할 수 없습니다.

-또는-

요청을 처리하는 동안 오류가 발생했습니다.

stylesheetUri 가 유효한 URI가 아닌 경우

스타일시트를 로드하는 동안 구문 분석 오류가 발생했습니다.

예제

다음 예제에서는 변환을 실행하고 파일에 출력합니다.

// Load the style sheet.
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load("output.xsl");

// Execute the transform and output the results to a file.
xslt.Transform("books.xml", "books.html");
' Load the style sheet.
Dim xslt As New XslCompiledTransform()
xslt.Load("output.xsl")
        
' Execute the transform and output the results to a file.
xslt.Transform("books.xml", "books.html")

설명

클래스는 XslCompiledTransform XSLT 1.0 구문을 지원합니다. XSLT 스타일시트는 네임스페이스를 http://www.w3.org/1999/XSL/Transform 사용해야 합니다.

이 메서드의 동작은 다음과 같습니다.

  • 사용자 자격 증명이 없는 A XmlUrlResolver 는 스타일시트 URI를 확인하고 모든 xsl:import 요소 또는 xsl:include 요소를 처리하는 데 사용됩니다.

  • XmlReader 기본 설정은 스타일시트를 로드하는 데 사용됩니다. 에서 DTD 처리를 사용할 수 XmlReader없습니다. DTD 처리가 필요한 경우 이 기능을 사용하도록 설정한 상태로 XmlReader 만들고 메서드에 Load 전달합니다.

  • 함수를 document() 사용할 수 없습니다.

  • 포함된 스크립트는 지원되지 않습니다.

오버로드를 Load(String, XsltSettings, XmlResolver) 사용하여 필요한 인증 자격 증명을 XmlResolver 사용하여 지정하거나 다른 XSLT 설정을 지정할 수 있습니다.

추가 정보

적용 대상

Load(IXPathNavigable)

Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs
Source:
XslCompiledTransform.cs

개체에 포함된 스타일시트를 컴파일합니다 IXPathNavigable .

public:
 void Load(System::Xml::XPath::IXPathNavigable ^ stylesheet);
public void Load(System.Xml.XPath.IXPathNavigable stylesheet);
member this.Load : System.Xml.XPath.IXPathNavigable -> unit
Public Sub Load (stylesheet As IXPathNavigable)

매개 변수

stylesheet
IXPathNavigable

인터페이스를 구현하는 개체입니다 IXPathNavigable . Microsoft .NET Framework에서 이는 스타일시트를 XmlNode 포함하는 (일반적으로 XmlDocument) XPathDocument 일 수 있습니다.

예외

stylesheet 값은 null.

스타일시트에 오류가 있습니다.

예제

다음은 개체에 포함된 스타일시트를 로드하는 예제입니다 XPathDocument .

XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load(new XPathDocument("http://serverName/data/xsl/sort.xsl"));
Dim xslt As New XslCompiledTransform()
xslt.Load(New XPathDocument("http://serverName/data/xsl/sort.xsl"))

설명

클래스는 XslCompiledTransform XSLT 1.0 구문을 지원합니다. XSLT 스타일시트는 네임스페이스를 http://www.w3.org/1999/XSL/Transform 사용해야 합니다.

이 메서드의 동작은 다음과 같습니다.

  • XmlUrlResolver 사용자 자격 증명이 없는 항목은 모든 xsl:import 요소 또는 xsl:include 요소를 처리하는 데 사용됩니다.

  • 함수를 document() 사용할 수 없습니다.

  • 포함된 스크립트는 지원되지 않습니다.

오버로드를 Load 사용하여 필요한 인증 자격 증명을 XmlResolver 사용하여 지정하거나 다른 XSLT 설정을 지정할 수 있습니다.

추가 정보

적용 대상