2014-10-14 2 views
0

에 클래스를 할당하는 나는 다음과 같은 XSL 태그가 :어떻게 XSL 요소

<xsl:element name="a"> 
       <xsl:attribute name="href"> 
       <xsl:value-of select="QuickLink" /> 
       </xsl:attribute> 
       <xsl:value-of select="Html/root/NewsArticle/artTitle" /> 
      </xsl:element> 

가 어떻게 링크 A에 클래스를 할당 할을? 당신은 당신이 xsl:element 필요가없는 요소 이름을 계산할 필요가없는 모든

답변

2

클래스는 속성입니다. href 속성을 추가 한 것과 같은 방식으로 추가 할 수 있습니다.

<xsl:element name="a"> 
    <xsl:attribute name="href"> 
    <xsl:value-of select="QuickLink" /> 
    </xsl:attribute> 
    <xsl:attribute name="class"> 
    <xsl:value-of select="some-class-name" /> 
    </xsl:attribute> 
    <xsl:value-of select="Html/root/NewsArticle/artTitle" /> 
</xsl:element> 
+0

감사합니다. 같은 방식으로'title' 태그를 추가 할 수 있습니까? – SearchForKnowledge

+0

예. 중요한 구조입니다. 원하는 이름의 태그를 추가 할 수 있습니다. – Trevor

+0

그래서이 경우 이름은'title'입니까? – SearchForKnowledge

3

먼저, 당신은 단순히 리터럴 결과 요소를 작성할 수 있습니다

<a href="{QuickLink}" class="some-class-name"><xsl:value-of select="Html/root/NewsArticle/artTitle"/></a>