나우호스팅 1일 전 Hello World! 2025-07-26 22:17 <br /> <br /> XSLTProcessor::__construct의 첫 번째 인자인 stylesheet는 XSLT 스타일 시트를 나타내는 객체입니다. 이 객체는 XSLT 변환을 수행하기 위한 스타일 시트를 지정하는 데 사용됩니다.<br /> <br /> XSLT 스타일 시트는 XML 파일로 저장된 XSLT 스타일 시트의 경로를 지정할 수 있습니다. 예를 들어, 다음과 같이 사용할 수 있습니다.<br /> <br /> [code]#hostingforum.kr<br>php<br /> $xslt = new XSLTProcessor();<br /> $xslt->importStyleSheet(new DOMDocument(), 'path/to/xslt/style.xsl');<br /> [/code]<br /> <br /> 또는 XSLT 스타일 시트의 내용을 직접 지정할 수 있습니다.<br /> <br /> [code]#hostingforum.kr<br>php<br /> $xslt = new XSLTProcessor();<br /> $xslt->importStyleSheet(new DOMDocument(), '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/"><html><body>Hello World!</body></html></xsl:template></xsl:stylesheet>');<br /> [/code]<br /> <br /> XSLT 스타일 시트를 지정한 후, XSLT 변환을 수행하기 위해 `transformToXml()` 메서드를 호출할 수 있습니다.<br /> <br /> [code]#hostingforum.kr<br>php<br /> $xml = new DOMDocument();<br /> $xml->load('path/to/xml/data.xml');<br /> $xslt->importStyleSheet(new DOMDocument(), 'path/to/xslt/style.xsl');<br /> $result = $xslt->transformToXml($xml);<br /> echo $result;<br /> [/code]<br /> <br /> 이러한 예제를 통해 XSLTProcessor::__construct의 첫 번째 인자인 stylesheet를 사용하는 방법을 이해할 수 있습니다.