2011-02-16 5 views
0

groundup.xml과 groundup.xslt의 두 파일이 있습니다.xslt에서 텍스트를 표시하는 데 문제가 있습니다.

groundup.xml :

<content> 
    <root> 
    <housing_option_name>The first name</housing_option_name> 
    <housing_option_headline>Live under a desk</housing_option_headline> 
    <housing_option_address>Kinda behind the Shell gas station</housing_option_address> 
    <include_description>true</include_description> 
    <description_images>/uploadedImages/RecSports/Intramural_Sports/Photos/Basketball 055.jpg</description_images> 
    <description_images>/uploadedImages/StudyAbroad/Slideshow/Adamwood.jpg</description_images> 
    <room_types_and_layouts>Here you can sleep. Here you eat.</room_types_and_layouts> 
    <include_virtual_room_tour>false</include_virtual_room_tour> 
    <include_photos>true</include_photos> 
    </root> 
    <root> 
    <housing_option_name>A real housing option</housing_option_name> 
    <housing_option_headline>where fun comes to multiply</housing_option_headline> 
    <housing_option_address> 
     The address goes here 
    </housing_option_address> 
    <include_description>false</include_description> 
    <description_images>/uploadedImages/bg_mural_Partner_for_Success.jpg</description_images> 
    <room_types_and_layouts>Some text about room types and layouts.</room_types_and_layouts> 
    <include_virtual_room_tour>false</include_virtual_room_tour> 
    <include_photos>true</include_photos> 
    </root> 
</content> 

그리고 groundup.xslt :

<?xml version="1.0" encoding="utf-8"?> 
<xsl:stylesheet 
    version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns="http://www.w3.org/1999/xhtml"> 
    <xsl:output method="html" indent="yes" encoding="utf-8"/> 
    <xsl:template match="/"> 

    <html> 
     <body> 

     <div id="residence_halls"> 
      <ul> 
      <xsl:for-each select="content/root"> 
       <div> 
       <xsl:attribute name="id"> 
        <xsl:value-of select="translate(housing_option_name, ' ', '_')"/> 
       </xsl:attribute> 

       <xsl:value-of select="content/root/housing_option_name"/> 
       </div> 
      </xsl:for-each> 
      </ul> 
     </div> 

     </body> 
    </html> 
    </xsl:template> 

</xsl:stylesheet> 

내가 그러나 나는 아직도 노력하고있어, id 필드에 housing_option_name를 얻을 수 있었다 최종 html에 텍스트로 표시되도록 housing_option_name을 가져옵니다. 방금 빈 화면이 보이지만 최종 소스를 보면 housing_option_name의 ID를 가진 두 div가 있지만 div 안에는 텍스트가 없습니다.

무엇이 여기에 있습니까?

편집 :

<html xmlns="http://www.w3.org/1999/xhtml"> 
    <body> 
    <div id="residence_halls"> 
     <div id="The_first_name"> 
     </div> 
     <div id="A_real_housing_option"> 
     </div> 
    </div> 
    </body> 
</html> 

편집 : 최종 HTML은 다음과 같습니다

답변

1
  <xsl:value-of select="housing_option_name"/> 

확실히 간결 ULS을 툭? 콘텐츠/루트 경로에서 이미 각자의 입장에 있기 때문에?

+0

고마워요! 9 분 안에 너의 대답을 받아 들일거야. :) – lowerkey

관련 문제