2011-03-03 7 views
2

음 xsl을 xsd에 적용하라는 지시를 받았습니다. 승인. 그러나 오페라는 그것을 허용하지 않습니다.오페라에서 xsl을 xsl에 적용 할 때의 문제

XSD 파일 :

<?xml version="1.0" encoding="UTF-8" ?> 
<?xml-stylesheet href="sammple.xsl" type="text/xsl" ?> 
<xs:schema elementFormDefault="qualified" 
xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
    <xs:element name="global" type="globaltype"/> 
</xs:schema> 

XSL 파일 : 나는 파이어 폭스에 sample.xsd를 호출 할 경우

<?xml version="1.0" encoding="UTF-8"?> 
<xsl:stylesheet version="2.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:xs="http://www.w3.org/2001/XMLSchema"> 

    <xsl:template match="xs:element[@name='global']"> 
     <xsl:text>sample</xsl:text> 
    </xsl:template> 

    <xsl:template match="/" name="main"> 
     <xsl:apply-templates /> 
    </xsl:template> 
</xsl:stylesheet> 

이, 아무런 문제가 없습니다. 텍스트 "샘플"을 생성합니다.

하지만 오페라에서 호출하는 경우, 인 오류가 온다 :

This document had an invalid XSLT stylesheet. Error message from the XSLT engine: Error: invalid XML output: unexpected text (non-whitespace text outside root element)

내가 무엇을 할 수는?

편집 : 내 환경 :

오페라 : 버전 11.01
파이어 폭스 : 버전 3.6.13
HTTP 서버 :

답변

4

1.4.28은 엄밀히 말하면 lighttpd를, 당신 만 출력의 한 조각을 포함 텍스트 (sample)이고 스타일 시트는 텍스트가 출력되어야한다고 지정하지 않습니다. 오페라는 XML을 출력하고 XML 문서가 유효하지 않을 때 화가 나올 것이라고 예상합니다.

시도 중 스타일 시트 <xsl:output method="text" /> 추가 또는 <root><xsl:text>sample</xsl:text></root>합니다 ( <xsl:text> 소자 이때 실제로 불필요한 유의, <root>Sample</root> 할 것이다.)

+0

들어, 요소 <xsl:text>sample</xsl:text> 둘러싸 : 출력 방법 = "text"/> 내 문제가 해결되었습니다. 고맙습니다. 나는 그 생각조차하지 않았다 – savruk

+0

+1 정답. Presto (Opera)와 Webkit (Chrome, Safari)은'xml' 직렬화 방법의 결과를 재분석합니다. –

관련 문제