2013-03-14 5 views
1

내 XML 코드입니다 : 내가 원하는<xsl : value-of> 태그를 통해 올바른 선택을하는 방법은 무엇입니까? 다음

<abbr> 
<title>world health organization</title>who</abbr> 
was founded in 1948. 

위의 코드에서 XSLT 출력으로 : 나는 XSLT 코드 다음 썼다

<abbr title="world health organisation">who<abbr> 

:

<xsl:template match ="abbr"> 
&lt;abbr title="<xsl:value-of select ="title"/>"&gt; 
<xsl:value-of select ="."/>&lt;/abbr&gt; 
</xsl:template> 

과 내가 가지고 :

<abbr title="world health organization"> 
world health organizationwho</abbr> 

어디서 잘못 됐습니까?

<xsl:value-of select"."/> 

의 출력은 내가 첫 번째 부분을 원하는 그나마 지금

world health organisationwho 

(세계 보건기구 + 사람)

입니다. 어떻게이 작업을 수행 할 수 있습니까?

답변

2

titleabbr의 하위 항목이므로 title의 텍스트는 abbr의 문자열 값의 일부입니다. 이것을 시도하십시오 :

<xsl:template match ="abbr"> 
    <abbr title="{title}"> 
    <xsl:apply-templates select="text()"/> 
    </abbr> 
</xsl:template> 

을 덧붙여, 당신은 당신의 XSLT에서 xsl:output method="text"을 사용하고 있습니까? XSLT를 사용하여 XML을 생성하는 경우 method="xml"을 사용해야합니다. 그것이 XSLT가 만든 것입니다.

+0

감사합니다 ... 작동했습니다 :) –