
XSLTProcessor::importStylesheet는 기존의 스타일 시트와 병합하는 메서드입니다. 새로운 스타일 시트를 추가하려면, XSLTProcessor의 인스턴스를 새로 생성하고 importStylesheet 메서드를 호출하면 됩니다.
#hostingforum.kr
php
$xslt1 = new XSLTProcessor();
$xslt1->importStylesheet($xsl_file1);
$xslt2 = new XSLTProcessor();
$xslt2->importStylesheet($xsl_file2);
이러한 방식으로, 두 개의 스타일 시트를 병합하여 사용할 수 있습니다.
XSLTProcessor::importStylesheet의 동작 원리는 다음과 같습니다.
1. XSLTProcessor 인스턴스를 생성합니다.
2. importStylesheet 메서드를 호출하여 XSLT 스타일 시트를 임포트합니다.
3. 임포트된 스타일 시트는 기존의 스타일 시트와 병합됩니다.
4. 병합된 스타일 시트는 XSLTProcessor 인스턴스에 저장됩니다.
예제 코드를 살펴보겠습니다.
#hostingforum.kr
php
$xsl_file1 = 'style1.xsl';
$xsl_file2 = 'style2.xsl';
$xslt1 = new XSLTProcessor();
$xslt1->importStylesheet($xsl_file1);
$xslt2 = new XSLTProcessor();
$xslt2->importStylesheet($xsl_file2);
// 두 개의 스타일 시트를 병합하여 사용할 수 있습니다.
$xslt = new XSLTProcessor();
$xslt->importStylesheet($xslt1);
$xslt->importStylesheet($xslt2);
이러한 방식으로, 두 개의 스타일 시트를 병합하여 사용할 수 있습니다.
2025-07-15 09:04